pg.ddx.io  pgsql-docs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: David G. Johnston <david.g.johnston@gmail.com>
Cc: splarv@ya.ru <splarv@ya.ru>
Cc: pgsql-docs@lists.postgresql.org <pgsql-docs@lists.postgresql.org>
Subject: Re: Savepoints in plpgsql
Date: Fri, 12 Jul 2024 09:42:24 -0400
Message-ID: <2320320.1720791744@sss.pgh.pa.us> (raw)
In-Reply-To: <CAKFQuwZXC2dDsDMLg77kWO4c7aiFwEn5LS9Hc9p-iooHXK+Ecw@mail.gmail.com>
References: <172076354433.736586.14347210271966220018@wrigleys.postgresql.org>
	<CAKFQuwZXC2dDsDMLg77kWO4c7aiFwEn5LS9Hc9p-iooHXK+Ecw@mail.gmail.com>

"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





view thread (4+ messages)  latest in thread

Message-ID: <2320320.1720791744@sss.pgh.pa.us>
Permalink:  ../2320320.1720791744@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/2320320.1720791744@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-docs@postgresql.org
  Cc: tgl@sss.pgh.pa.us, david.g.johnston@gmail.com, splarv@ya.ru, pgsql-docs@lists.postgresql.org
  Subject: Re: Savepoints in plpgsql
  In-Reply-To: <2320320.1720791744@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox