Re: [GENERAL] Two-phase commmit, plpgsql and plproxy

2009-02-12 Thread Joshua Tolley
On Thu, Feb 12, 2009 at 02:17:03AM +0300, Igor Katson wrote: PostgreSQL does not provide a transaction manager. When you are dealing with multiple databases, the transaction manager needs to make decisions like this transaction failed on one node, therefore we need to roll all the other

[GENERAL] Two-phase commmit, plpgsql and plproxy

2009-02-11 Thread Igor Katson
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

Re: [GENERAL] Two-phase commmit, plpgsql and plproxy

2009-02-11 Thread Jeff Davis
On Wed, 2009-02-11 at 12:43 +0300, Igor Katson wrote: ERROR: XX000: SPI_execute_plan failed executing query PREPARE TRANSACTION '2pctest': SPI_ERROR_TRANSACTION It's probably treating the word PREPARE specially. You can avoid this problem by using EXECUTE and specifying the command as a

Re: [GENERAL] Two-phase commmit, plpgsql and plproxy

2009-02-11 Thread Igor Katson
Jeff Davis wrote: On Wed, 2009-02-11 at 12:43 +0300, Igor Katson wrote: ERROR: XX000: SPI_execute_plan failed executing query PREPARE TRANSACTION '2pctest': SPI_ERROR_TRANSACTION It's probably treating the word PREPARE specially. You can avoid this problem by using EXECUTE and

Re: [GENERAL] Two-phase commmit, plpgsql and plproxy

2009-02-11 Thread Jeff Davis
On Thu, 2009-02-12 at 00:57 +0300, Igor Katson wrote: Thanks, Jeff. That's not good news, cause I am not able to do that. There may be some creative solution, but I don't know plproxy well enough to suggest one. The postgres manual says, that The intended usage of the feature is that a

Re: [GENERAL] Two-phase commmit, plpgsql and plproxy

2009-02-11 Thread Igor Katson
Jeff Davis wrote: On Thu, 2009-02-12 at 00:57 +0300, Igor Katson wrote: Thanks, Jeff. That's not good news, cause I am not able to do that. There may be some creative solution, but I don't know plproxy well enough to suggest one. The postgres manual says, that The intended usage