Обсуждение: Post to another db using pl/pgsql

Поиск
Список
Период
Сортировка

Post to another db using pl/pgsql

От
Robert Fitzpatrick
Дата:
I've worked with pgsql for a while, but never needed to post from a
database trigger to another db. Is this possible? And if so, can someone
offer a pointer to the docs on how to refer to other db's in my script,
etc?

--
Robert


Re: Post to another db using pl/pgsql

От
tv@fuzzy.cz
Дата:
> I've worked with pgsql for a while, but never needed to post from a
> database trigger to another db. Is this possible? And if so, can someone
> offer a pointer to the docs on how to refer to other db's in my script,
> etc?

What do you mean by 'other db'? Does that mean other PostgreSQL database,
or a completely different db (say MySQL for example)?

There is a dblink contrib package - I've never worked with it, but I guess
you can use it to post to a different PostgreSQL db. AFAIK posting to a
MySQL from pl/pgsql is not possible, but you can use pl/perl with proper
packages for example.

regards
Tomas


Re: Post to another db using pl/pgsql

От
tv@fuzzy.cz
Дата:
> I've worked with pgsql for a while, but never needed to post from a
> database trigger to another db. Is this possible? And if so, can someone
> offer a pointer to the docs on how to refer to other db's in my script,
> etc?

What do you mean by 'other db'? Does that mean other PostgreSQL database,
or a completely different db (say MySQL for example)?

There is a dblink contrib package - I've never worked with it, but I guess
you can use it to post to a different PostgreSQL db. AFAIK posting to a
MySQL from pl/pgsql is not possible, but you can use pl/perl with proper
packages for example.

regards
Tomas



Re: Post to another db using pl/pgsql

От
Robert Fitzpatrick
Дата:
On Wed, 2008-11-12 at 18:02 +0100, tv@fuzzy.cz wrote:
> > I've worked with pgsql for a while, but never needed to post from a
> > database trigger to another db. Is this possible? And if so, can someone
> > offer a pointer to the docs on how to refer to other db's in my script,
> > etc?
>
> What do you mean by 'other db'? Does that mean other PostgreSQL database,
> or a completely different db (say MySQL for example)?

Sorry, yes, I'm wanting to post to another pgsql db on the same server.

--
Robert


Re: Post to another db using pl/pgsql

От
Steve Atkins
Дата:
On Nov 12, 2008, at 8:55 AM, Robert Fitzpatrick wrote:

> I've worked with pgsql for a while, but never needed to post from a
> database trigger to another db. Is this possible? And if so, can
> someone
> offer a pointer to the docs on how to refer to other db's in my
> script,
> etc?

Look for dblink (if it's another postgresql database) or dbilink (if
it isn't).

dblink is documented in one of the appendices of the postgresql
manual.

Cheers,
   Steve