Re: Nested Stored Procedures - ERROR: invalid transaction termination 2D000 - Mailing list pgsql-general

From Tom Lane
Subject Re: Nested Stored Procedures - ERROR: invalid transaction termination 2D000
Date
Msg-id 442118.1742684108@sss.pgh.pa.us
Whole thread Raw
In response to Re: Nested Stored Procedures - ERROR: invalid transaction termination 2D000  (Kevin Stephenson <kjs714@hotmail.com>)
List pgsql-general
Kevin Stephenson <kjs714@hotmail.com> writes:
> Christophe and Tom, thank you for your responses, but I'm still a bit confused. In my original email, the Test 2 case
isallowing a ROLLBACK in the EXCEPTION clause without throwing an error. Is it a NOP ROLLBACK being applied to an
abortedsubTX, 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



pgsql-general by date:

Previous
From: Christophe Pettus
Date:
Subject: Re: Nested Stored Procedures - ERROR: invalid transaction termination 2D000
Next
From: Igor Korot
Date:
Subject: Determine server version from psql script