Pg upgrade bug with NOT NULL NOT VALID - Mailing list pgsql-hackers

From Kirill Reshke
Subject Pg upgrade bug with NOT NULL NOT VALID
Date
Msg-id CALdSSPgYCJu2AjUti9gnW9n7jfE-xZBDLA=n7N3JOQYCfUd+=g@mail.gmail.com
Whole thread
Responses Re: Pg upgrade bug with NOT NULL NOT VALID
List pgsql-hackers
On pg 17:

create table t(i int not null);
alter table t add constraint t_i_not_null check((i is not null)) not valid;


then upgrade to current master, will fail with

```
pg_restore: error: could not execute query: ERROR:  constraint
"t_i_not_null" for relation "t" already exists
Command was: ALTER TABLE "public"."t"
    ADD CONSTRAINT "t_i_not_null" CHECK (("i" IS NOT NULL)) NOT VALID;
```


I think we need to fix this in the spirit of [0]. I'm currently
thinking of choosing a less obvious name for NOT NULL constraint that
is created during CREATE TABLE processing. Is that a good way to
address this? This will impact non-pg_upgrade creations too, is this
important?

If so, I will share a patch on this

[0] https://git.postgresql.org/cgit/postgresql.git/commit/?id=3db61db48ef5b8898f7e85f98548fdec79d76524

-- 
Best regards,
Kirill Reshke



pgsql-hackers by date:

Previous
From: Michael Paquier
Date:
Subject: Re: Fix pg_stat_wal_receiver to show CONNECTING status
Next
From: Chao Li
Date:
Subject: Re: Fix pg_stat_wal_receiver to show CONNECTING status