Re: BUG #15631: Generated as identity field in a temporary table with on commit drop corrupts system catalogs - Mailing list pgsql-bugs

From Tom Lane
Subject Re: BUG #15631: Generated as identity field in a temporary table with on commit drop corrupts system catalogs
Date
Msg-id 31358.1549981670@sss.pgh.pa.us
Whole thread Raw
In response to Re: BUG #15631: Generated as identity field in a temporary table withon commit drop corrupts system catalogs  (Peter Eisentraut <peter.eisentraut@2ndquadrant.com>)
Responses Re: BUG #15631: Generated as identity field in a temporary tablewith on commit drop corrupts system catalogs
List pgsql-bugs
Peter Eisentraut <peter.eisentraut@2ndquadrant.com> writes:
> On 11/02/2019 21:33, Tom Lane wrote:
>> I don't have time to probe further right now, but I believe what is
>> wrong is that we're missing a CommandCounterIncrement call after the
>> sequence is created, or at least after its internal dependency on the
>> table column is created.  When the transaction commits immediately,
>> dependency.c fails to see the internal dependency entry and so it
>> doesn't remove the sequence.  Wrapped in a transaction, there's a
>> CCI somewhere and all is well.

> Right.  I think it would be good to put a CommandCounterIncrement() at
> the top of PreCommit_on_commit_actions().  That ensures that the
> dependency code always see the latest state.

Hm, I'd be more inclined to find where the sequence creation is happening
and add a CCI at the end, because that comports better with the general
plan for inserting CCIs.  There may be other issues of this same sort with
doing-X-just-after-identity-sequence-creation if you don't fix it that
way.

>> That bollixes later attempts to clean out the temp
>> namespace, since deletion tries to recurse to the missing table.

> Should there be some warnings when this happens?

Like what?

            regards, tom lane


pgsql-bugs by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: BUG #15631: Generated as identity field in a temporary table withon commit drop corrupts system catalogs
Next
From: Pavlo Golub
Date:
Subject: Re: BUG #15626: Incorrect version number shown in BigSQL installation