daily pastebin goal
93%
SHARE
TWEET

Untitled

a guest Oct 3rd, 2017 57 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. CREATE SERVER myremotedb FOREIGN DATA WRAPPER
  2.     dblink_fdw OPTIONS (host 'myremotedb.123456.eu-west-1.rds.amazonaws.com', port '5432', dbname 'my_db');
  3.  
  4. CREATE USER MAPPING FOR treex SERVER myremotedb OPTIONS (user 'foouser', password '1234');
  5.  
  6. GRANT USAGE ON FOREIGN SERVER myremotedb TO foouser;
  7.    
  8. SELECT dblink_connect('myremotedb', 'host=myremotedb.123456.eu-west-1.rds.amazonaws.com , port=5432 , user=foouser , password=1234 , dbname=mwu');
  9.  
  10. select * from dblink('myremotedb', 'SELECT * FROM my_data') AS T(id integer, name text);
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top