Re: SPI function to investigate query semantics - Mailing list pgsql-patches

From Tom Lane
Subject Re: SPI function to investigate query semantics
Date
Msg-id 19153.1101935583@sss.pgh.pa.us
Whole thread Raw
In response to Re: SPI function to investigate query semantics  (Thomas Hallgren <thhal@mailblocks.com>)
List pgsql-patches
Thomas Hallgren <thhal@mailblocks.com> writes:
> So what *is* the appropriate way of  starting, releasing, and rolling
> back savepoints then?

We haven't got one that will work from inside arbitrary functions ---
DefineSavepoint and friends don't get it done by themselves, but
expect you to call CommitTransactionCommand/StartTransactionCommand,
and those functions tend to pull the rug out from under the executor.
(I seem to recall trying to do it that way in the first attempt on
plpgsql, and running into all kinds of memory management issues.)

The existing PLs use BeginInternalSubTransaction,
ReleaseCurrentSubTransaction, RollbackAndReleaseCurrentSubTransaction,
but these are subset implementations only suited for
exception-block-structured code.

            regards, tom lane

pgsql-patches by date:

Previous
From: Thomas Hallgren
Date:
Subject: Re: SPI function to investigate query semantics
Next
From: Thomas Hallgren
Date:
Subject: Re: SPI function to investigate query semantics