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

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>
Cc: dnsl48(at)gmail(dot)com, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #15631: Generated as identity field in a temporary table with on commit drop corrupts system catalogs
Date: 2019-02-12 14:27:50
Message-ID: 31358.1549981670@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)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

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Pavlo Golub 2019-02-12 15:18:10 Re: BUG #15626: Incorrect version number shown in BigSQL installation
Previous Message Peter Eisentraut 2019-02-12 14:00:34 Re: BUG #15631: Generated as identity field in a temporary table with on commit drop corrupts system catalogs