Hello, it seems that between pqsl 17 and 18, the behavior of the
following reproducer has changed:
====
CREATE TABLE reproducer(id int NOT NULL); ALTER TABLE reproducer DROP
COLUMN "id", ADD COLUMN "id" int, ADD PRIMARY KEY("id");
====
Expected output (this is the case on psql 16 and 17):
====
CREATE TABLE
ALTER TABLE
====
Actual output (on psql (PostgreSQL) 18.6 (Ubuntu 18.6-0ubuntu0.26.04.1)):
====
CREATE TABLE
ERROR: 42P16: primary key column "id" is not marked NOT NULL
LOCATION: index_check_primary_key, index.c:266
====
I could not find anything direcly related in the change notes
(https://www.postgresql.org/docs/release/18.0/). There were a few lines
related to NULL, but with my knowledge I could not be sure if they were
relevant.
I hope you can accept my bug report, or let me know the reason why if
this is correct behavior.
Best regards,
--
//Ludvig Janiuk