Re: Cross database reference (databases are on the same

Поиск
Список
Период
Сортировка
Искать
От
scott.marlowe
Тема
Re: Cross database reference (databases are on the same
Дата
Msg-id
Pine.LNX.4.33.0304081601280.20181-100000@css120.ihs.com
Ответ на
Список
Дерево обсуждения
Re: Cross database reference (databases are on the same Medi Montaseri <medi.montaseri@intransa.com>
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"  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.

В списке pgsql-general по дате отправления
От: Flower Sun
Дата:
От: Joe Conway
Дата:
FAQ