"David G. Johnston" <david.g.johnston@gmail.com> writes:
> On Thursday, July 11, 2024, PG Doc comments form <noreply@postgresql.org>
> wrote:
>> In this section nothing mentioned that a savepoint (a subtransaction) will
>> not work inside plpgsql.
> Correct, we prefer to just document how things work. 43.2 does mention
> that blocks form subtransactions.
It probably would be reasonable to mention something about this
in 43.8, if only to provide an excuse to cross-reference 43.6.8.
I'm imagining more or less
PL/pgSQL does not support savepoints (SAVEPOINT/ROLLBACK TO
SAVEPOINT/RELEASE SAVEPOINT commands). Typical usage patterns
for savepoints can be replaced by blocks with exception handlers
(see 43.6.8).
I also notice the last para
A transaction cannot be ended inside a block with exception handlers.
which seems like it could be tied into that somehow. Maybe eliminate
that as a separate para, and write
PL/pgSQL does not support savepoints (SAVEPOINT/ROLLBACK TO
SAVEPOINT/RELEASE SAVEPOINT commands). Typical usage patterns
for savepoints can be replaced by blocks with exception handlers
(see 43.6.8). Under the hood, a block with exception handlers
forms a subtransaction, which means that transactions cannot
be ended inside such a block.
regards, tom lane