update data in different database

Started by Henriksen, Jonas Fover 21 years ago3 messagesgeneral
Jump to latest
#1Henriksen, Jonas F
jonas.f.henriksen@imr.no

Hi,

is it possible to write a trigger, using pl/pgSQL, that updates tables in a different database than the one the trigger is called from? If it is, what is the syntax for calling the other database? My to databases are on the same server.

Regards Jonas:))

#2Karsten Hilbert
Karsten.Hilbert@gmx.net
In reply to: Henriksen, Jonas F (#1)
Re: update data in different database

is it possible to write a trigger, using pl/pgSQL, that
updates tables in a different database than the one the trigger
is called from? If it is, what is the syntax for calling the
other database? My to databases are on the same server.

One way I can think of is using dblink from the contrib/
directory. It can be used to connect to another database from
within the one you are primarily connected to.

Karsten
--
GPG key ID E4071346 @ wwwkeys.pgp.net
E167 67FD A291 2BEA 73BD 4537 78B9 A9F9 E407 1346

#3Richard Huxton
dev@archonet.com
In reply to: Henriksen, Jonas F (#1)
Re: update data in different database

Henriksen, Jonas F wrote:

Hi,

is it possible to write a trigger, using pl/pgSQL, that updates
tables in a different database than the one the trigger is called
from? If it is, what is the syntax for calling the other database? My
to databases are on the same server.

Look into the dblink package in the contrib directory of the source
distribution (or your contrib package)

--
Richard Huxton
Archonet Ltd