17

Can someone please shed some light on how to install the requirements for Postgres 9 (Centos) to be able to use dblink for inter-postgres db querying.

There seems to be no clean documentation out there on how to install dblink requirements in general.

Thanks in advance.

Matty Bear
  • 517
  • 1
  • 4
  • 16

2 Answers2

38

If you have PostgreSQL 9.1 (or later), make sure the contrib package is installed, e.g., from your shell:

yum install postgres*contrib

Then within the database, use the DDL to create the extension:

CREATE EXTENSION dblink;
Mike T
  • 41,085
  • 18
  • 152
  • 203
  • on my system, you need to add another asterisk, in case the system is: `sudo yum install postgresql92-contrib.x86_64` I would have done `sudo yum install postgresql*contrib*` – Clown Man Aug 11 '15 at 22:11
  • I had to do sudo apt-get install postgres*contrib. – inquisitive Jan 22 '16 at 10:47
7

Install DbLink DbLink is located in share/contribs/dblink.sql of your PostgreSQL install.To use it, load the dblink.sql file in the database you would like to use it in.

Source: http://www.postgresonline.com/journal/archives/44-Using-DbLink-to-access-other-PostgreSQL-Databases-and-Servers.html

Ian Gow
  • 94
  • 1