Re: connecting to a differnt DB in PL/pgSQL

Поиск
Список
Период
Сортировка
От Franco Bruno Borghesi
Тема Re: connecting to a differnt DB in PL/pgSQL
Дата
Msg-id 200304141416.08254.franco@akyasociados.com.ar
обсуждение исходный текст
Ответ на Re: connecting to a differnt DB in PL/pgSQL  (Tomasz Myrta <jasiek@klaster.net>)
Ответы Re: connecting to a differnt DB in PL/pgSQL  (friedrich nietzsche <nietzsche_psql@yahoo.it>)
Список pgsql-sql
you should install dblink as Tomasz said. To do that:

cd ...../postgresql-7.3.2/contrib/dblink
gmake
gmake install

then you enter into psql to create the functions:
\i dblink.psql

then you try (change the params):

SELECT    *
FROM    dblink('host=localhost port=5432 dbname=franco user=admin password=1234',
'SELECT id, name FROM people')    AS (id INTEGER, people TEXT);

If you skip the values host, port, ..., the defaults will be used.
If it works in psql, it should work inside a function.




On Monday 14 April 2003 12:45, Tomasz Myrta wrote:
> Uz.ytkownik friedrich nietzsche napisa?:
> > Hi all,
> > Is it possible to connect to another database within a
> > PL/PgSQL function?
> >
> > I'm in a function on the "A" database and I need to
> > retrieve some information from a table in a different
> > Database "B"
> >
> > may someone help me?
> >
> > thanks, Danilo.
> > bye.
>
> You can't access another database even inside 1 server directly.
> Find something about contrib/dblink - maybe it will help you.
>
> Regards,
> Tomasz Myrta
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Don't 'kill -9' the postmaster

В списке pgsql-sql по дате отправления:

Предыдущее
От: "Daniel Seichter"
Дата:
Сообщение: SELECT Blobs into Delphi program
Следующее
От: "mdc@keko.com.ar"
Дата:
Сообщение: help with query!!!