Skip to content

Instantly share code, notes, and snippets.

@xxx
Last active July 14, 2017 22:08
Show Gist options
  • Save xxx/ec3b35b83d07ef1d37a4af819723842b to your computer and use it in GitHub Desktop.
Save xxx/ec3b35b83d07ef1d37a4af819723842b to your computer and use it in GitHub Desktop.
CREATE SCHEMA staging;
CREATE EXTENSION postgres_fdw;
CREATE SERVER staging FOREIGN DATA WRAPPER postgres_fdw OPTIONS (host 'hostname', dbname 'dbname', port'5432');
CREATE USER MAPPING FOR CURRENT_USER SERVER staging OPTIONS (user 'username', password 'password');
IMPORT FOREIGN SCHEMA public FROM SERVER staging INTO staging;
-- CREATE TABLE public.lol AS SELECT * from staging.users where <whatever>...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment