From: | "scott(dot)marlowe" <scott(dot)marlowe(at)ihs(dot)com> |
---|---|
To: | Flower Sun <sun_2002_flower(at)yahoo(dot)com> |
Cc: | Pgsql Group <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: Cross database reference (databases are on the same |
Date: | 2003-04-08 22:04:41 |
Message-ID: | Pine.LNX.4.33.0304081601280.20181-100000@css120.ihs.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Tue, 8 Apr 2003, Flower Sun wrote:
>
> Hi, Scott,
> Thank you for your reply. Can you give us a sample of using the first method using dblink?
> (My postgresql server is 7.2 preinstalled while installing redhat 8.0, I even cannot find the */contrib/* directory you mentioned).
> "scott.marlowe" <scott(dot)marlowe(at)ihs(dot)com> wrote:On Tue, 8 Apr 2003, Flower Sun wrote:
You may or may not have the contrib directory. While I use redhat, I've
always run Postgresql from a tar.gz build, so I've always had the contrib
directory laying around. I think you could probably just download 7.2.4
and use the contrib directory from there for dblink. It has lots of
examples in it on how to use it in the /contrib/dblink/doc directory.
For example:
select dblink_connect('dbname=template1');
dblink_connect
----------------
OK
(1 row)
test=# select * from dblink('dbname=template1','select proname, prosrc
from pg_proc')
as t1(proname name, prosrc text) where proname like 'bytea%';
proname | prosrc
------------+------------
byteacat | byteacat
byteaeq | byteaeq
bytealt | bytealt
byteale | byteale
byteagt | byteagt
byteage | byteage
byteane | byteane
byteacmp | byteacmp
bytealike | bytealike
byteanlike | byteanlike
byteain | byteain
byteaout | byteaout
(12 rows)
so, it's pretty much a function set that connects to the other database
and lets you pull in data from it.
From | Date | Subject | |
---|---|---|---|
Next Message | Joe Conway | 2003-04-08 22:31:08 | Re: Cross database reference (databases are on the same |
Previous Message | Josh Berkus | 2003-04-08 21:52:40 | Re: [SQL] Yet Another (Simple) Case of Index not used |