Kevin Stephenson <[email protected]> writes:
> Christophe and Tom, thank you for your responses, but I'm still a bit
> confused. In my original email, the Test 2 case is allowing a ROLLBACK in the
> EXCEPTION clause without throwing an error. Is it a NOP ROLLBACK being
> applied to an aborted subTX, a real full ROLLBACK, or something else? Please
> advise.
The sub-transaction only exists for the body of the BEGIN construct,
up until EXCEPTION. By the time control arrives at an exception
handler, we've rolled back the sub-xact and are executing in the outer
transaction again. So if that's a top-level transaction, you can roll
it back, but if it's a subtransaction you can't.
regards, tom lane