Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1roQZJ-001P1I-27 for pgsql-general@arkaria.postgresql.org; Sun, 24 Mar 2024 16:19:33 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1roQZH-00DztU-Dj for pgsql-general@arkaria.postgresql.org; Sun, 24 Mar 2024 16:19:31 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1roQW3-00Dto2-QL for pgsql-general@lists.postgresql.org; Sun, 24 Mar 2024 16:16:12 +0000 Received: from smtp85.iad3a.emailsrvr.com ([173.203.187.85]) by makus.postgresql.org with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1roQVw-006CAz-Fb for pgsql-general@lists.postgresql.org; Sun, 24 Mar 2024 16:16:10 +0000 X-Auth-ID: xof@thebuild.com Received: by smtp27.relay.iad3a.emailsrvr.com (Authenticated sender: xof-AT-thebuild.com) with ESMTPSA id 11BBF210F1; Sun, 24 Mar 2024 12:16:03 -0400 (EDT) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.120.23.2.7\)) Subject: Re: Is this a buggy behavior? From: Christophe Pettus In-Reply-To: <582a40a4-ac92-4247-8cea-bae9f2da5c73@aklaver.com> Date: Sun, 24 Mar 2024 09:15:55 -0700 Cc: "pgsql-generallists.postgresql.org" Content-Transfer-Encoding: quoted-printable Message-Id: <879037EC-39F7-49E8-A6D7-0FFD3EC2BA0A@thebuild.com> References: <51eb3063-1d90-40c6-a8c6-9a77fe105a61@gelassene-pferde.biz> <2005111.1711293431@sss.pgh.pa.us> <582a40a4-ac92-4247-8cea-bae9f2da5c73@aklaver.com> To: Thiemo Kellner X-Mailer: Apple Mail (2.3608.120.23.2.7) X-Classification-ID: 59c12611-085a-433c-8525-81787721e7a9-1-1 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 3/24/24 08:28, Thiemo Kellner wrote: > Sure, my example has lots more side effect than silently do the right = thing. I think the point is that it's not really doing anything "silently." = You are asking for a PRIMARY KEY constraint on a column, and it's giving = it to you. One of the effects (not even really a side-effect) of that = request is that the column is then declared NOT NULL. The reason it doesn't give you a warning is that by the time it would be = in a position to, it's forgotten that you explicitly said NULL. It does = see that the column in nullable, but that in itself isn't worth emitting = a warning over, since you are explicitly telling it that now the column = shouldn't be null. It wouldn't make much more sense to emit a warning = there than it would be in this situation: CREATE TABLE t (i int NULL); ALTER TABLE t ALTER i SET NOT NULL; --=20 Adrian Klaver adrian.klaver@aklaver.com