Re: dblink: rollback transaction - Mailing list pgsql-general

From Oleg Lebedev
Subject Re: dblink: rollback transaction
Date
Msg-id 993DBE5B4D02194382EC8DF8554A52731D7A10@postoffice.waterford.org
Whole thread Raw
In response to dblink: rollback transaction  ("Oleg Lebedev" <oleg.lebedev@waterford.org>)
Responses Re: dblink: rollback transaction  (Joe Conway <mail@joeconway.com>)
List pgsql-general
>>I think that is a main take-away here. You should not try to depend on

>>dblink as a robust replication solution. Perhaps if postgres had
>>two-phase commit and nested transactions, but not at the moment.

Agreed. I wonder if I should simulate local Xactions by using local
dblink calls?
What do you think, Joe?

>>That said, depending on how you are implementing the loop in your
>>pseudo-code, you might be able to get closer by using persistent
dblink
>>connections, and starting a transaction on the remote side before
>>starting the local transaction and running your plpgsql function (or
>>whatever it is you're running). If the local transaction fails, send
an
>>ABORT to the remote side before closing the connection. However I
can't
>>offhand think of a way to do that in an automated fashion.

So, is it actually possible to use BEGIN; .. COMMIT; statement with
dblink?

Even if I start the remote Xaction before the local one starts, there is
no way for me to catch an exception thrown by the local Xaction. I don't
think Pl/PgSQL supports exceptions. So, if the local Xaction throws an
exception then the whole process terminates.

Ideas?

Thanks.

Oleg

*************************************
This e-mail may contain privileged or confidential material intended for the named recipient only.
If you are not the named recipient, delete this message and all attachments.
Unauthorized reviewing, copying, printing, disclosing, or otherwise using information in this e-mail is prohibited.
We reserve the right to monitor e-mail sent through our network.
*************************************

pgsql-general by date:

Previous
From: Mike Charnoky
Date:
Subject: Re: pg_restore and large files
Next
From: Mike Charnoky
Date:
Subject: Re: pg_restore and large files