Re: About subxact and xact nesting level...

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Thomas Munro <thomas(dot)munro(at)enterprisedb(dot)com>
Cc: david(at)andl(dot)org, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: About subxact and xact nesting level...
Date: 2016-05-02 02:00:26
Message-ID: 29564.1462154426@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Thomas Munro <thomas(dot)munro(at)enterprisedb(dot)com> writes:
> On Mon, May 2, 2016 at 12:24 PM, <david(at)andl(dot)org> wrote:
>> The file xact.c contains references to sub-transactions (subxact) and
>> transaction nesting level, but no obvious documentation about what these
>> correspond to in SQL.

> Subtransactions are used to implement SAVEPOINT, and also BEGIN blocks
> with EXCEPTION clauses in plpgsql.

Yeah. The implementation is based on nested subtransactions, and that
concept also applies pretty directly to, eg, BEGIN/EXCEPT blocks in
plpgsql. But what's exposed to SQL is SAVEPOINT/RELEASE SAVEPOINT/
ROLLBACK TO SAVEPOINT, because those operations are what the standard
specifies. If you hold your head at the correct angle you can see those
as nested subtransactions, but it's not exactly obvious --- mainly because
RELEASE and ROLLBACK can exit multiple levels of nested subtransaction in
one command.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message McCoy, Shawn 2016-05-02 02:39:02 Need help debugging why autovacuum seems "stuck" -- until I use superuser to vacuum freeze pg_database
Previous Message Thomas Munro 2016-05-02 01:15:52 Re: About subxact and xact nesting level...