Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lCP2B-0003rW-9m for pgsql-bugs@arkaria.postgresql.org; Wed, 17 Feb 2021 15:46:35 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lCP2A-0005BU-4x for pgsql-bugs@arkaria.postgresql.org; Wed, 17 Feb 2021 15:46:34 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lCP29-0005BM-V3 for pgsql-bugs@lists.postgresql.org; Wed, 17 Feb 2021 15:46:33 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lCP27-00041y-BB for pgsql-bugs@lists.postgresql.org; Wed, 17 Feb 2021 15:46:32 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 11HFkThs2536807; Wed, 17 Feb 2021 10:46:30 -0500 From: Tom Lane To: sean@respax.com cc: pgsql-bugs@lists.postgresql.org Subject: Re: BUG #16870: ADD COLUMN IF NOT EXISTS with GENERATED ALWAYS AS IDENTITY can cause duplicate sequence In-reply-to: <16870-edb7e5bae3587d01@postgresql.org> References: <16870-edb7e5bae3587d01@postgresql.org> Comments: In-reply-to PG Bug reporting form message dated "Wed, 17 Feb 2021 00:30:13 +0000" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <2536805.1613576789.1@sss.pgh.pa.us> Date: Wed, 17 Feb 2021 10:46:29 -0500 Message-ID: <2536806.1613576789@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk PG Bug reporting form writes: > Hello, I'm getting unexpected behaviour with IDENTITY columns when running > ALTER TABLE ADD COLUMN IF NOT EXISTS on them when they already exist. Yeah, this is a known issue: the IF NOT EXISTS operates to skip the actual creation of the column, but it fails to suppress secondary operations such as adding indexes or serial sequences. It's fixed in v13, but the changes were too major to consider back-patching. regards, tom lane