Two-phase commmit, plpgsql and plproxy - Mailing list pgsql-general

From Igor Katson
Subject Two-phase commmit, plpgsql and plproxy
Date
Msg-id 49929DA9.7070709@gmail.com
Whole thread Raw
Responses Re: Two-phase commmit, plpgsql and plproxy
Re: [Plproxy-users] Two-phase commmit, plpgsql and plproxy
List pgsql-general
I would like to call several plproxy functions one after another (which
will call plpgsql functions in different target partitions), and in case
one of them fails, i want to roll back changes in every one.

That is exactly how two-phase-commit (2PC) should work.

As far as I understand, the postgres' group of statements like PREPARE
TRANSACTION can do this job. But when trying to insert a 'PREPARE
TRANSACTION' statement into a PL/Pgsql function I get an error:

ERROR:  XX000: SPI_execute_plan failed executing query "PREPARE
TRANSACTION '2pctest'": SPI_ERROR_TRANSACTION

Is there a way to achieve the needed behaviour with two-phase commmit,
plpgsql and plproxy ?

pgsql-general by date:

Previous
From: Max Strömberg
Date:
Subject: Re: In need of help with message fetching query
Next
From: Igor Katson
Date:
Subject: Making a result of transaction visible to everyone, saving the ability for a rollback