Assume the 2 databases are being named as dbA and dbB and the connection are from dbA
dbB User ID: [USER_ID]
dbB Password: [PASSWORD]
To enable db_link, run the command below to enable db_link function
psql -U postgres postgres=# CREATE EXTENSION dblink
postgres=# \dx
SELECT events.* FROM dblink('dbname=dbB user=[USER_ID] password=[PASSWORD]','SELECT title FROM events') AS events(title character varying(255));
No comments:
Post a Comment