Tuesday, July 9, 2013

ERROR: function dblink_connect(unknown) does not exist

PostgreSQL Link from another database

Activate function DBlink :

CREATE EXTENSION dblink;




Connection Link Query :
 select dblink_connect('host=servername user=username password=password dbname=databasename')  ;

Result :
OK



Select from another database Query :

SELECT *
    FROM dblink('
host=servername user=username password=password dbname=databasename', 'select column1, column2 from TableProductMaster ')
      AS t1(Column1 text, Column2 text) -- as field and field type
    WHERE column1 LIKE '%556%'  -- as Condition
    Order by Column1 Asc;



Result :
Column 1    | Column2
A|1
B|2
C|3


Thank You










1 comment:

dhitinair said...

Iam facing with an error when executing connection link query. ERROR: could not establish connection

Post a Comment