dblink questions

From: "Brian Maguire" <bmaguire(at)vantage(dot)com>
To: <pgsql-general(at)postgresql(dot)org>
Subject: dblink questions
Date: 2003-12-08 02:14:04
Message-ID: 203C7FC3FF2D7A4588CE0429A87F3C9A0AC458@vt-pe2550-001.vantage.vantage.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

What's the best way to create a connection with dblink with persisted connections with web applications?

For example:

I want to have a view that links to a table in another pg database so I can mask the connection and make it easier to query.

so I would do this ...

create view myremote_pg_proc as
select *
from dblink('myconnection','select proname, prosrc from pg_proc')
as t1(proname name, prosrc text);

so I can do this ...

select * from myremote_pg_proc where proname like 'bytea%';

I understand that a connection can be made by dblink_connect(text connstr) and
dblink_connect(text connname, text connstr), but how do you suggest making the first connection from a web application?

select dblink('myconnection','127.0.0.1 port=5432 dbname=template1 user=postgres password=mypasswd')

Do you suggestion not using the persistent connection? and do this?

create view myremote_pg_proc as
select *
from dblink('myconnection','127.0.0.1 port=5432 dbname=template1 user=postgres password=mypasswd','select proname, prosrc from pg_proc')
as t1(proname name, prosrc text);

Thanks a Bunch,

Brian

Browse pgsql-general by date

  From Date Subject
Next Message pg 2003-12-08 03:43:18 Re: last update time of a table
Previous Message Seum-Lim Gan 2003-12-08 00:54:34 Re: pg_hba.conf change in 7.4