Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Installing DBLink for Postgres 9

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.

like image 593
Matty Bear Avatar asked Feb 22 '11 07:02

Matty Bear


People also ask

How do I create a dblink in PostgreSQL?

Load the dblink extension into PostgreSQL. CREATE EXTENSION dblink; Create a persistent connection to a remote PostgreSQL database using the dblink_connect function specifying a connection name (myconn), database name (postgresql), port (5432), host (hostname), user (username) and password (password).

Does PostgreSQL support dblink?

dblink is a module that supports connections to other PostgreSQL databases from within a database session.

How does dblink work in PostgreSQL?

Description. dblink executes a query (usually a SELECT , but it can be any SQL statement that returns rows) in a remote database. When two text arguments are given, the first one is first looked up as a persistent connection's name; if found, the command is executed on that connection.

How do I check Postgres dblink?

You can get all open dblink connections using dblink_get_connections() . Those that are not used can only be found by examining your function code like Erwin suggests.


1 Answers

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;
like image 126
Mike T Avatar answered Oct 02 '22 20:10

Mike T