Re: [subxacts] Savepoint syntax - Mailing list pgsql-patches

From Tom Lane
Subject Re: [subxacts] Savepoint syntax
Date
Msg-id 24020.1090905775@sss.pgh.pa.us
Whole thread Raw
In response to Re: [subxacts] Savepoint syntax  (Alvaro Herrera <alvherre@dcc.uchile.cl>)
List pgsql-patches
Alvaro Herrera <alvherre@dcc.uchile.cl> writes:
>> Attached is the savepoints syntax patch, hopefully last try.
>> - Tab completion patch from Gaetano is included.

Reviewed and committed.

I did not apply your changes to spi.c, instead choosing to revert it to
the former coding that disallowed any TransactionStmts.  I don't think
it will possibly work for SPI to execute such commands: if it did,
control would return to the caller with a different active transaction,
different active memory context, etc.

Oracle's PL/SQL behavior seems to posit that the PL/SQL function
executes "outside the database" and can have local state that is not
affected by SAVEPOINT, ROLLBACK, et al.  I'm not sure if we really
want to support that, but in any case there's no chance of doing it
for 7.5.  Our functions very definitely execute inside transactions.

What we could do at the SPI level is to provide functions that
encapsulate start-subxact/execute-command/commit-or-abort-subxact
so that control returns in the same subxact you started in, and you
can get control back if the executed command fails.

            regards, tom lane

pgsql-patches by date:

Previous
From: Claudio Natoli
Date:
Subject: Re: win32 version info
Next
From: Alvaro Herrera
Date:
Subject: [subxacts] Some docs