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 1lhfCo-0005fY-Ne for pgsql-bugs@arkaria.postgresql.org; Fri, 14 May 2021 21:18:46 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lhfCn-0006Oh-Dq for pgsql-bugs@arkaria.postgresql.org; Fri, 14 May 2021 21:18:45 +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 1lhfCn-0006OY-7O for pgsql-bugs@lists.postgresql.org; Fri, 14 May 2021 21:18:45 +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 1lhfCl-00079g-4X for pgsql-bugs@lists.postgresql.org; Fri, 14 May 2021 21:18:44 +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 14ELIeX52194412; Fri, 14 May 2021 17:18:40 -0400 From: Tom Lane To: Shay Rojansky cc: Vik Fearing , Amit Langote , 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: <2191863.1621023482@sss.pgh.pa.us> References: <16913-3b5198410f67d8c6@postgresql.org> <7c02b352-a2e4-e71a-ae69-7e410daf5774@postgresfriends.org> <2441173.1615563048@sss.pgh.pa.us> <3fb6c576-182e-e664-f64a-a65a74da85de@postgresfriends.org> <2191863.1621023482@sss.pgh.pa.us> Comments: In-reply-to Tom Lane message dated "Fri, 14 May 2021 16:18:02 -0400" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <2194410.1621027120.1@sss.pgh.pa.us> Date: Fri, 14 May 2021 17:18:40 -0400 Message-ID: <2194411.1621027120@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk I wrote: > GENERATED BY DEFAULT does create a NOT NULL constraint: > ... > so I think the patch is doing what it was intended to. Whether GENERATED > BY DEFAULT *should* be forcing NOT NULL is a separate question, but > AFAIK it always has. Ah, found it. SQL:2016 11.4 syntax rule 16 saith: If ICS is specified, then: ... d) The NOT NULL NOT DEFERRABLE is implicit. The production includes both cases: ::= GENERATED { ALWAYS | BY DEFAULT } AS IDENTITY [ ] so the spec does clearly say that both alternatives force NOT NULL. So, it was my error to write the release notes as though only GENERATED ALWAYS is affected. I'll go adjust that, though it won't propagate to the website for another three months :-( regards, tom lane