Extension dblink
suggest changeThe dblink extension connects to another database and runs a query there. To use it:
- Create the extension:
CREATE EXTENSION dblink;
- Run the remote query.
For example, select columns from a table in another database. The AS list must name every output column and its type:
SELECT * FROM
dblink ('dbname = bd_distance port = 5432 host = 10.6.6.6 user = username
password = passw@rd', 'SELECT id, code FROM schema.table')
AS newTable(id INTEGER, code character varying);
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents