foreign-data-wrapper

How to force evaluation of subquery before joining / pushing down to foreign server

断了今生、忘了曾经 提交于 2020-05-15 09:30:29
问题 Suppose I want to query a big table with a few WHERE filters. I am using Postgres 11 and a foreign table; foreign data wrapper (FDW) is clickhouse_fdw . But I am also interested in a general solution. I can do so as follows: SELECT id,c1,c2,c3 from big_table where id=3 and c1=2 My FDW is able to do the filtering on the remote foreign data source, ensuring that the above query is quick and doesn't pull down too much data. The above works the same if I write: SELECT id,c1,c2,c3 from big_table

Foreign-data wrapper “postgres_fdw” does not exist (even if it does)

让人想犯罪 __ 提交于 2020-04-30 06:31:19
问题 Using PostgreSQL 10.10, from superuser postgres : CREATE EXTENSION postgres_fdw; GRANT USAGE ON FOREIGN DATA WRAPPER postgres_fdw TO my_user; Then when doing the following from my_user : CREATE SERVER my_server FOREIGN DATA WRAPPER postgres_fdw OPTIONS (...); This error message is displayed: Query 1 ERROR: ERROR: foreign-data wrapper "postgres_fdw" does not exist Here is the list of currently active foreign data wrappers (from psql): postgres=# \dew List of foreign-data wrappers Name | Owner

How to connect to localhost with postgres_fdw?

旧城冷巷雨未停 提交于 2020-01-11 02:36:10
问题 The idea is that I have local database named northwind , and with postgres_fdw I want to connect with another database named test on localhost (remote connection simulation, for situations like when table in my database is updated, do something in other database like save to history etc..). So I opened psql console and type: CREATE SERVER app_db FOREIGN DATA WRAPPER postgres_fdw OPTIONS (dbname 'test', host 'localhost:5432'); As i found in A Look at Foreign Data Wrappers link. Next I also

How to UPDATE table from csv file?

余生长醉 提交于 2020-01-05 10:33:19
问题 How to update table from csv file in PostgreSQL? (version 9.2.4) Copy command is for insert. But I need to update table. How can I update table from csv file without temp table? I don't want to copy to temp table from csv file and update table from temp table. And no merge command like Oracle? 回答1: The simple and fast way is with a temporary staging table, like detailed in this closely related answer: How to update selected rows with values from a CSV file in Postgres? If you don't "want"

Do databases besides Postgres have features comparable to foreign data wrappers?

岁酱吖の 提交于 2020-01-03 08:21:50
问题 I'm very excited by several of the more recently-added Postgres features, such as foreign data wrappers. I'm not aware of any other RDBMS having this feature, but before I try to make the case to my main client that they should begin preferring Postgres over their current cocktail of RDBMSs, and include in my case that no other database can do this, I'd like to verify that. I've been unable to find evidence of any other database supporting SQL/MED, and things like this short note stating that

Change a normal table to a foreign “cstore_fdw” table

﹥>﹥吖頭↗ 提交于 2019-12-24 06:48:12
问题 Is it possible to change a normal table to a foreign table in Postgresql? At least, if it's not possible, can I copy data from a normal table to a foreign table? 回答1: https://github.com/citusdata/cstore_fdw: To load or append data into a cstore table, you have two options: You can use the COPY command to load or append data from a file, a program, or STDIN. You can use the INSERT INTO cstore_table SELECT ... syntax to load or append data from another table. so follow the example: create

Can PostgreSQL perform a join between two SQL Server stored procedures?

天大地大妈咪最大 提交于 2019-12-18 09:23:21
问题 This question is related to an earlier one: Why is selecting from stored procedure not supported in relational databases? On SQL Server you cannot perform a join to (or a select from) a stored procedure (please note: a stored procedure is distinctly different from a function (table-valued function in SQL Server terminology) - with a function, you know the columns being returned at design time, but with a procedure, the specific columns to be returned are not known until runtime). With SQL

could not load library for oracle_fdw

岁酱吖の 提交于 2019-12-12 02:42:50
问题 I am facing issue while creating oracle_fdw. I have copied oracle_fdw.dll to postgres lib folder * both .sql file and control file to shrared/extension now when I connect to psql with superadmin user & make an query create extension oracle_fdw; I am getting response ERROR: could not load library "D:/postgresdb/lib/oracle_fdw.dll": The specified procedure could not be found. 回答1: From the error it seems that the oracle_fdw library is not available in the lib folder of postGreSQL installation

Importing data from MS Access db to PostgreSQL db

心已入冬 提交于 2019-12-10 19:54:33
问题 I have a table in an MS Access db that I want to export to a PostgreSQL database. Every 2 or so months, I want to move all records from the Access table to a table in Postgres. Right now, I am using the Export to ODBC option in Access to do this, but every time it exports as an entirely new table in Postgres. Is there a way for me to routinely append the records in the Access table to an existing table in my Postgres database? I have come across the option of a FDW but I am not familiar with

Postgres: foreign key to foreign table

百般思念 提交于 2019-12-10 14:11:50
问题 I have a foreign table, for example: CREATE FOREIGN TABLE film ( id varchar(40) NOT NULL, title varchar(40) NOT NULL, did integer NOT NULL, date_prod date, kind varchar(10), len interval hour to minute ) SERVER film_server; with id as the primary key for that table (set in the remote database). I would like to have a local table reference the foreign table, and set a foreign key constraint on the local table -- for example: CREATE TABLE actor ( id varchar(40) NOT NULL, name varchar(40) NOT