pg.ddx.io pgsql-admin@postgresql.org mailing list archive
help / color / mirror / Atom feed'dblink' Help
2+ messages / 2 participants
[nested] [flat]
* 'dblink' Help
@ 2004-01-27 10:53 JinNet Picker <netpicker9@yahoo.com>
2004-01-31 19:38 ` Re: 'dblink' Help Joe Conway <mail@joeconway.com>
0 siblings, 1 reply; 2+ messages in thread
From: JinNet Picker @ 2004-01-27 10:53 UTC (permalink / raw)
To: pgsql-admin
Hi,
I have Two databases names 'MyDb1' and 'MyDb2' in My
System.
I have installed Postgres 7.4 with dblink
What i need is, when ever a NEW record is inserted in
'MyDb1' , i want fire a Trigger or Rule to insert the
Same Record to MyDb2 database.
I am Using MAC OS 10.2
Anybody Got Idea how to do this?
Thanks
----------------------------------------------
Some Sample Query Using "dblink" is:
select * from dblink('hostaddr=192.168.1.1
dbname=MyDb1 user=pgsql','select
username,password,usertype from users') as t1(username
varchar,password varchar,usertype varchar);
----------------------------------------------
__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free web site building tool. Try it!
http://webhosting.yahoo.com/ps/sb/
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: 'dblink' Help
2004-01-27 10:53 'dblink' Help JinNet Picker <netpicker9@yahoo.com>
@ 2004-01-31 19:38 ` Joe Conway <mail@joeconway.com>
0 siblings, 0 replies; 2+ messages in thread
From: Joe Conway @ 2004-01-31 19:38 UTC (permalink / raw)
To: JinNet Picker <netpicker9@yahoo.com>; +Cc: pgsql-admin
JinNet Picker wrote:
> What i need is, when ever a NEW record is inserted in
> 'MyDb1' , i want fire a Trigger or Rule to insert the
> Same Record to MyDb2 database.
> Anybody Got Idea how to do this?
See the dblink documentation for dblink_exec(), and see the Postgres
documentation for how to create triggers:
http://www.postgresql.org/docs/current/static/triggers.html
You'll probably want to create the trigger function using PL/pgSQL:
http://www.postgresql.org/docs/current/static/plpgsql.html
Joe
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2004-01-31 19:38 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2004-01-27 10:53 'dblink' Help JinNet Picker <netpicker9@yahoo.com>
2004-01-31 19:38 ` Joe Conway <mail@joeconway.com>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox