Created
May 8, 2020 16:07
-
-
Save crojasaragonez/877bd88027484aa1b342df005ae4c8f1 to your computer and use it in GitHub Desktop.
describes how to configure a foreign table in postgres
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
create extension postgres_fdw; | |
CREATE SERVER postgres_2 | |
FOREIGN DATA WRAPPER postgres_fdw | |
OPTIONS (dbname 'db_2', host '172.17.0.4', port '5432'); | |
CREATE USER MAPPING FOR CURRENT_USER | |
SERVER postgres_2 | |
OPTIONS (user 'usr', password 'pwd'); | |
IMPORT FOREIGN SCHEMA "public" limit to (table_name) FROM SERVER postgres_2 INTO public; | |
select * from table_name | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment