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.98.2) (envelope-from ) id 1x79I5-000000008Ev-2sjq for pgsql-bugs@arkaria.postgresql.org; Thu, 17 Sep 2026 10:24:31 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.98.2) (envelope-from ) id 1x79I2-00000003lhQ-2olh for pgsql-bugs@arkaria.postgresql.org; Thu, 17 Sep 2026 10:24:26 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1x78mg-00000003QFl-2nFR for pgsql-bugs@lists.postgresql.org; Thu, 17 Sep 2026 09:52:02 +0000 Received: from mail-10629.protonmail.ch ([79.135.106.29]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1x78mc-00000000yzD-2Wg8 for pgsql-bugs@lists.postgresql.org; Thu, 17 Sep 2026 09:52:02 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=proton.me; s=protonmail; t=1789638718; x=1789897918; bh=Wt3xawQaImtpso0s3xt0V6Ypvl7RmJI8/6ycwF58j5U=; h=Date:To:From:Subject:Message-ID:Feedback-ID:From:To:Cc:Date: Subject:Reply-To:Feedback-ID:Message-ID:BIMI-Selector; b=akdwgNDZiFiYqvBSmQW0dwNkTYmFoLSxYMzhZX2rJzR2ItZRbAT8bbkMLmBo3cmEO YFAG+vgL1NWbD7PvCT43OKQuIECBwelOR7Ndx6cJ0mI4jN6JsuIQV0DGa4dRfCZmxd 1XYY5BqYMy7HDPBX/kHccLlb4XzpDdf7P6YFupV5u7NrOgbYK+RSVhvnuyBfMNUcVg vM/7D9n1LhL3gSGRPdB9gOrpVFLVn8+XTp1Mp5fmDkAQ/iKGLyBGRs9ANvxvMlPUrh ldLadbr6cEGYmCaoyZNk9MzQO1nqlHrAfakiymSK+PMVwcb0RTd0JEkypCkCmpjWhw wHkT44Rr6TrrQ== Date: Thu, 17 Sep 2026 09:51:54 +0000 To: pgsql-bugs@lists.postgresql.org From: Ludvig Janiuk Subject: 42P16 error when dropping and adding column Message-ID: <0a9b4c44-cdff-4ec8-a8fb-b3a8b59e9ba9@proton.me> Feedback-ID: 90025008:user:proton X-Pm-Message-ID: bbf1b076ca7a98e87d09c216a3212c20140b74d6 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hello, it seems that between pqsl 17 and 18, the behavior of the=20 following reproducer has changed: =3D=3D=3D=3D CREATE TABLE reproducer(id int NOT NULL); ALTER TABLE reproducer DROP=20 COLUMN "id", ADD COLUMN "id" int, ADD PRIMARY KEY("id"); =3D=3D=3D=3D Expected output (this is the case on psql 16 and 17): =3D=3D=3D=3D CREATE TABLE ALTER TABLE =3D=3D=3D=3D Actual output (on=C2=A0psql (PostgreSQL) 18.6 (Ubuntu 18.6-0ubuntu0.26.04.1= )): =3D=3D=3D=3D CREATE TABLE ERROR:=C2=A0 42P16: primary key column "id" is not marked NOT NULL LOCATION:=C2=A0 index_check_primary_key, index.c:266 =3D=3D=3D=3D I could not find anything direcly related in the change notes=20 (https://www.postgresql.org/docs/release/18.0/). There were a few lines=20 related to NULL, but with my knowledge I could not be sure if they were=20 relevant. I hope you can accept my bug report, or let me know the reason why if=20 this is correct behavior. Best regards, --=20 //Ludvig Janiuk