Thomas Hallgren <thhal@mailblocks.com> writes:
> From your statement it sounds like you want to use the subtransactions
> solely in a hidden mechanism and completely remove the ability to use
> them from the function developer. Is that a correct interpretation?
No; I would like to develop the ability to specify savepoints in pltcl
and plperl, so that already-executed SPI commands can be rolled back at
need. But that is a feature for later --- it's way too late to think
about it for 8.0. Moreover, having that will not remove the requirement
for the state after catching a SPI error to be sane.
The fundamental point you are missing, IMHO, is that a savepoint is a
mechanism for rolling back *already executed* SPI commands when the
function author wishes that to happen. A failure in an individual
command should not leave the function in a broken state.
regards, tom lane