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 1gtZ2Z-0005XU-N2 for pgsql-bugs@arkaria.postgresql.org; Tue, 12 Feb 2019 14:28:03 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gtZ2X-0006hO-Kj for pgsql-bugs@arkaria.postgresql.org; Tue, 12 Feb 2019 14:28:01 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gtZ2X-0006hG-BA for pgsql-bugs@lists.postgresql.org; Tue, 12 Feb 2019 14:28:01 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gtZ2Q-0002Pk-5F for pgsql-bugs@lists.postgresql.org; Tue, 12 Feb 2019 14:27:59 +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 x1CERor5031359; Tue, 12 Feb 2019 09:27:50 -0500 From: Tom Lane To: Peter Eisentraut cc: 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: <043b0c10-5a27-b9ff-7451-b8a2ca9327b1@2ndquadrant.com> References: <15631-188663b383e1e697@postgresql.org> <24188.1549917188@sss.pgh.pa.us> <043b0c10-5a27-b9ff-7451-b8a2ca9327b1@2ndquadrant.com> Comments: In-reply-to Peter Eisentraut message dated "Tue, 12 Feb 2019 15:00:34 +0100" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <31357.1549981670.1@sss.pgh.pa.us> Date: Tue, 12 Feb 2019 09:27:50 -0500 Message-ID: <31358.1549981670@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Peter Eisentraut 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