Thread: postgres_fdw
Hi there,
I got a weird result while using postgres_fdw for foreign table import. It converted tables into type (and no data obviously). This is on Postgres 10.
psql -d locdb -U postgres -h localhost
CREATE EXTENSION postgres_fdw;
\dx
grant usage on FOREIGN DATA WRAPPER postgres_fdw to locdb_u1;
-- Now as locdb_u1
CREATE SERVER s1 FOREIGN DATA WRAPPER postgres_fdw OPTIONS (dbname 'remdb', host '170.17.5.20', port '5432');
CREATE USER MAPPING for calcium SERVER s1 OPTIONS (user 'remdb_u1', password 'remdb_u1');
IMPORT FOREIGN SCHEMA "remdb_fs" limit to (tab1, tab2, tab3, tab4) FROM SERVER s1 INTO local_schema1;
set schema 'local_schema1';
\dt
Did not find any relations.
And now I can see them in pgadmin as "Types" and not as tables (and obviously no data).
Am I doing anything wrong? Any suggestions?
PS: To protect the server /user details, i have renamed few things in email but all the commands have worked and now those exact four tables are appearing into local schema as four "types" with same structure as table and few more fields got added to it automatically ..
tableoid oid,
cmax cid,
xmax xid,
cmin cid,
xmin xid,
ctid tid,
id integer,
I am pasting above field names by using pgadmin create script on one of the type.
Please advise.