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 32505.1550241839@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 table withon commit drop corrupts system catalogs  (Peter Eisentraut <peter.eisentraut@2ndquadrant.com>)
List pgsql-bugs
Peter Eisentraut <peter.eisentraut@2ndquadrant.com> writes:
> What is the general coding principle here?  "You need an CCI $WHEN"?

The general principle is "there should be a CCI after each independent
set of data/catalog changes".  You don't typically need CCI between
the primitive actions of a single DDL statement like CREATE SEQUENCE,
because you know that those actions are independent and don't look at
each others' output.  But you need one at the end, in case whatever
happens next should be able to see the results of the statement.

In another universe the rule might have been "CCI before each independent
set of actions", rather than after.  But we haven't done it that way.
Mixing those two styles as a method of fixing bugs seems like a horrid
idea: you eventually end up with fore-AND-aft CCIs everywhere, because
nobody knows what the preceding or following statements might've done.
For better or worse, the PG rule is CCI-after, and the stuff that does
DDL on identity sequences has to fall in line.

            regards, tom lane


pgsql-bugs by date:

Previous
From: Francisco Olarte
Date:
Subject: Re: BUG #15637: Problem insert data 【Japanese】
Next
From: John Klann
Date:
Subject: Re: BUG #15636: PostgreSQL 11.1 pg_basebackup backup to a CIFSdestination throws fsync error at end of backup