Skip to content

Instantly share code, notes, and snippets.

@elmotec
Last active November 5, 2016 22:32
Show Gist options
  • Save elmotec/efea4e7a1dc23b4bd359152b4c34a01f to your computer and use it in GitHub Desktop.
Save elmotec/efea4e7a1dc23b4bd359152b4c34a01f to your computer and use it in GitHub Desktop.
-- creates fdw to the database quotes in a schema quotes_s
create extension if not exists postgres_fdw;
create server prod_s foreign data wrapper postgres_fdw options (host 'servername', dbname 'quotes', port '5432');
create user mapping for public server prod_s options (user 'name', password 'secret');
create schema quotes_s;
import foreign schema public from server prod_s into quotes_s;
commit;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment