Error connecting 2 postgres database with FOREIGN DATA WRAPPER

Asked

Viewed 52 times

0

I’m trying to connect two postgre databases and I’m getting an error importing the tables:

CREATE EXTENSION postgres_fdw;
CREATE SERVER gestware_server
  FOREIGN DATA WRAPPER postgres_fdw
  OPTIONS (host 'localhost', dbname 'gwrcsgf1');

CREATE USER MAPPING FOR CURRENT_USER
  SERVER gestware_server
  OPTIONS (user 'postgres', password 'senha');

CREATE SCHEMA app;

IMPORT FOREIGN SCHEMA public
  FROM SERVER gestware_server
  INTO app'

I get the message:

'ERROR: syntax error at or near "IMPORT" LINE 1: IMPORT FOREIGN SCHEMA public'

  • Your IMPORT command seems incomplete. Check your post.

  • Also check the postgres version. This command is only available from 9.5

  • That’s what happened. My version is 12.1 but the remote database is in 9.3. I used 'CREATE FOREIGN TABLE'

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.