dblink and commit

From: Daniel Chiaramello <daniel(dot)chiaramello(at)golog(dot)net>
To: pgsql-general(at)postgresql(dot)org
Subject: dblink and commit
Date: 2009-10-30 09:05:49
Message-ID: 4AEAAC6D.4050800@golog.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hello.

I an wondering how things happen, related to transactions using dblink.

I am doing the following thing (simplified, of course), on ServerA:

------------------------------------------------
BEGIN

insert into TableA_ServerA (...)
select * from dblink(ServerB, select * from tableA_ServerB)

insert into TableB_ServerA (...)
select * from dblink(ServerB, select * from tableB_ServerB)

dblink(serverB, delete from tableA_ServerB)
dblink(serverB, delete from tableB_ServerB)

COMMIT
------------------------------------------------

What happens if connection is lost when executing the last dblink? Are
the data from tableA_serverB deleted (what I would like to avoid)?

If they are deleted, is there a way to handle this - do the 2 local
insert and the 2 remote delete (normal case), but do nothing at all if
something went bad at one time?

Thanks for your attention,
Daniel

Browse pgsql-general by date

  From Date Subject
Next Message Thom Brown 2009-10-30 09:16:58 Re: Forms generator ?
Previous Message Marcin Stępnicki 2009-10-30 08:17:17 Re: Forms generator ?