Post to another db using pl/pgsql

Started by Robert Fitzpatrickover 17 years ago5 messagesgeneral
Jump to latest
#1Robert Fitzpatrick
lists@webtent.net

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

#2Tomas Vondra
tomas.vondra@2ndquadrant.com
In reply to: Robert Fitzpatrick (#1)
Re: Post to another db using pl/pgsql

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

#3Tomas Vondra
tomas.vondra@2ndquadrant.com
In reply to: Robert Fitzpatrick (#1)
Re: Post to another db using pl/pgsql

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

#4Robert Fitzpatrick
lists@webtent.net
In reply to: Tomas Vondra (#2)
Re: Post to another db using pl/pgsql

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

#5Steve Atkins
steve@blighty.com
In reply to: Robert Fitzpatrick (#1)
Re: Post to another db using pl/pgsql

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