Re: What is a savepointLevel ?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Edmund Horner <ejrh00(at)gmail(dot)com>
Cc: Chapman Flack <chap(at)anastigmatix(dot)net>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: What is a savepointLevel ?
Date: 2019-03-16 17:33:15
Message-ID: 30762.1552757595@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Edmund Horner <ejrh00(at)gmail(dot)com> writes:
> On Fri, 15 Mar 2019 at 18:18, Chapman Flack <chap(at)anastigmatix(dot)net> wrote:
>> What exactly is a savepointLevel?
>>
>> They seem to have been there for 15 years[1], diligently copied from
>> parent transactions to children, fastidiously checked to avoid crossing
>> a level on rollback or release, but does anything ever change the level
>> from its initial value? I'm drawing a blank[2].

> I had a look too, checking for uses where savepointLevel might be set
> as part of a struct initialisation. I can't find any.

Yeah, I think that the field's basically been there for future use
since day one. The SQL spec discusses savepoint levels, but as far
as I could find in some desultory searching, the only way to actually
change to a new savepoint level is to enter a function or procedure that
has the NEW SAVEPOINT LEVEL property, which is syntax we don't have.

Even though the code's dead today, I'm disinclined to remove it;
now that we have procedures, the need to treat savepoint levels
as a real feature might be closer upon us than it has been. It
doesn't look like it's costing any significant amount of cycles
or code anyhow.

(On the other hand, maybe this is something we'd never implement.
Attaching savepoint level control to the callee, rather than the
caller, seems pretty weird to me. AFAICS the point of a new
savepoint level would be to prevent the function from messing
with savepoints of the outer level, so I'd think what you'd want
is syntax whereby the caller can protect itself against the
callee doing that.)

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2019-03-16 17:43:09 Re: Willing to fix a TODO case in libpq module
Previous Message Peter Geoghegan 2019-03-16 17:32:14 Re: Making all nbtree entries unique by having heap TIDs participate in comparisons