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 1lKjke-0005Bj-72 for pgsql-bugs@arkaria.postgresql.org; Fri, 12 Mar 2021 15:30:56 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lKjkb-0003jF-Vf for pgsql-bugs@arkaria.postgresql.org; Fri, 12 Mar 2021 15:30:53 +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 1lKjkb-0003ev-Ow for pgsql-bugs@lists.postgresql.org; Fri, 12 Mar 2021 15:30:53 +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 1lKjkZ-0000zR-1x for pgsql-bugs@lists.postgresql.org; Fri, 12 Mar 2021 15:30:52 +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 12CFUmHL2441174; Fri, 12 Mar 2021 10:30:48 -0500 From: Tom Lane To: Amit Langote cc: Vik Fearing , pavel.boev@invitae.com, PostgreSQL mailing lists Subject: Re: BUG #16913: GENERATED AS IDENTITY column nullability is affected by order of column properties In-reply-to: References: <16913-3b5198410f67d8c6@postgresql.org> <7c02b352-a2e4-e71a-ae69-7e410daf5774@postgresfriends.org> Comments: In-reply-to Amit Langote message dated "Fri, 12 Mar 2021 21:59:14 +0900" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <2441172.1615563048.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Fri, 12 Mar 2021 10:30:48 -0500 Message-ID: <2441173.1615563048@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Amit Langote writes: > On Thu, Mar 11, 2021 at 11:37 PM Vik Fearing w= rote: >> On 3/4/21 3:22 PM, Vik Fearing wrote: >>> I can confirm this bug. Attached is a patch to prevent it. >> Would anybody like to take a look at this? > Patch looks reasonable to me. I think it's not really necessary to have two different tests; we can just make the code for IDENTITY include exactly what the code for CONSTR_NOTNULL does, ie it can set saw_not_null too. The point here is that IDENTITY can be read as implicitly including NOT NULL, so we can just act as though that was explicit. An alternative fix approach is to add to the list of conflict checks that are made after the loop, but I'm not sure that's any better. Will push it in a bit. regards, tom lane