7

Is there a way that I might query a database located on "Server 2" and get my data in "Server 1" ? That is return a set of records from a remote server to my local one.

PS: Not cross database query on same server because I know how to do that with dblink.

Update: great ty.

http://www.postgresonline.com/journal/index.php?/archives/44-Using-DbLink-to-access-other-PostgreSQL-Databases-and-Servers.html works like a charm. My bust was that I didn't see it on the dblink documentation on postgresql website.

AlexRednic
  • 326
  • 1
  • 6
  • 17
  • 3
    possible duplicate of [Possible to perform cross-database queries with postgres?](http://stackoverflow.com/questions/46324/possible-to-perform-cross-database-queries-with-postgres) – Milen A. Radev May 18 '10 at 13:33

2 Answers2

15

this is old - these days one would use the postgres_fdw module instead: https://www.postgresql.org/docs/9.3/static/postgres-fdw.html

radiospiel
  • 2,450
  • 21
  • 28
6

Apparently dblink can be used to query other servers - Using DbLink to access other PostreSQL Databases and Servers

yozey
  • 432
  • 3
  • 9