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: Michael Paquier <michael(at)paquier(dot)xyz>, 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-15 14:43:59
Message-ID: 32505.1550241839@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:
> 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

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message John Klann 2019-02-15 15:37:31 Re: BUG #15636: PostgreSQL 11.1 pg_basebackup backup to a CIFS destination throws fsync error at end of backup
Previous Message Francisco Olarte 2019-02-15 13:51:24 Re: BUG #15637: Problem insert data 【Japanese】