Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gueip-0003Mh-Cn for pgsql-bugs@arkaria.postgresql.org; Fri, 15 Feb 2019 14:44:11 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1guein-0003Xd-4z for pgsql-bugs@arkaria.postgresql.org; Fri, 15 Feb 2019 14:44:09 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gueim-0003XW-VD for pgsql-bugs@lists.postgresql.org; Fri, 15 Feb 2019 14:44:09 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gueik-0005IO-PJ for pgsql-bugs@lists.postgresql.org; Fri, 15 Feb 2019 14:44:08 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id x1FEhxcq032506; Fri, 15 Feb 2019 09:43:59 -0500 From: Tom Lane To: Peter Eisentraut cc: Michael Paquier , dnsl48@gmail.com, pgsql-bugs@lists.postgresql.org Subject: Re: BUG #15631: Generated as identity field in a temporary table with on commit drop corrupts system catalogs In-reply-to: <0bc96c3e-8a3f-414f-8ba7-f7f95a787d48@2ndquadrant.com> References: <15631-188663b383e1e697@postgresql.org> <24188.1549917188@sss.pgh.pa.us> <043b0c10-5a27-b9ff-7451-b8a2ca9327b1@2ndquadrant.com> <31358.1549981670@sss.pgh.pa.us> <20190213023817.GD5746@paquier.xyz> <20190213044104.GE5746@paquier.xyz> <0bc96c3e-8a3f-414f-8ba7-f7f95a787d48@2ndquadrant.com> Comments: In-reply-to Peter Eisentraut message dated "Fri, 15 Feb 2019 14:02:58 +0100" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <32504.1550241839.1@sss.pgh.pa.us> Date: Fri, 15 Feb 2019 09:43:59 -0500 Message-ID: <32505.1550241839@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Peter Eisentraut 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