Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- PostgreSQL dblink with named connections
- SELECT testtable.*
- FROM dblink('dbname=testdb port=5432 host=192.168.1.1 user=usr password=pw'
- ,'SELECT * FROM testtable')
- AS testtable(testtable_id integer, testtable_name text);
- SELECT dblink_connect('myconn'
- ,'dbname=testdb port=5432 host=192.168.1.1 user=usr password=pw');
- SELECT testtable.* FROM dblink('myconn', 'SELECT * FROM testtable')
- AS testtable(testtable_id integer, testtable_name text);
- ERROR: could not establish connection
- DETAIL: missing "=" after "myconn" in connection info string
- ********** Error **********
- ERROR: could not establish connection
- SQL state: 08001
- Detail: missing "=" after "myconn" in connection info string
- SELECT dblink_disconnect('myconn');
- ERROR: connection "myconn" not available
- ********** Error **********
- ERROR: connection "myconn" not available
- SQL state: 08003
- SELECT dblink_connect('dbname=testdb port=5432 host=192.168.1.1
- user=usr password=pw');
- SELECT testtable.* FROM dblink('SELECT * FROM testtable')
- AS testtable(testtable_id integer, testtable_name text);
- ERROR: connection not available
- ********** Error **********
- ERROR: connection not available
- SQL state: 08003
- SELECT dblink_disconnect();
- ERROR: connection not available
- ********** Error **********
- ERROR: connection not available
- SQL state: 08003
- SELECT *
- FROM dblink('SELECT * FROM testtable'
- ) AS testtable (testtable_id integer, testtable_name text);
Add Comment
Please, Sign In to add comment