| From: | Alexander Lakhin <exclusion(at)gmail(dot)com> |
|---|---|
| To: | Raja Sai pranav <rajasaipranav0(at)gmail(dot)com> |
| Cc: | alvherre(at)kurilemu(dot)de, pgsql-bugs(at)lists(dot)postgresql(dot)org |
| Subject: | Re: BUG #19928: pg_upgrade fails on v18 schema with NOT NULL ... NO INHERIT and inheritance |
| Date: | 2026-11-29 16:00:00 |
| Message-ID: | f8e024f7-f86d-4c96-b6cf-5b1abc4e0143@gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-bugs |
Hello Sai,
28.11.2026 17:09, Raja Sai pranav wrote:
> On 27.11.2026, Alexander Lakhin wrote:
> > I've found another case, which probably should be fixed as well:
> > create table inh_nn1 (f1 int primary key references inh_nn1);
> > alter table inh_nn1 alter constraint inh_nn1_f1_not_null no inherit;
> > ...
> > pg_restore: error: could not execute query: ERROR: cannot create primary key on column "f1"
>
> Thanks. This one isn't about inheritance or the foreign key, and it
> isn't specific to pg_upgrade. A plain table is enough:
>
> create table t (f1 int primary key);
> alter table t alter constraint t_f1_not_null no inherit;
>
> and then a plain pg_dump of it fails to restore with the same error,
> on master and on 18.7.
Thank you working on this!
I've discovered one more issue related to NOT NULL:
echo "CREATE DATABASE regression;
\connect regression
CREATE TABLE parent(i int);
CREATE TABLE child() INHERITS (parent);
ALTER TABLE parent ADD NOT NULL i NOT VALID;
COMMENT ON CONSTRAINT parent_i_not_null ON child IS 'comment on child';
" >/tmp/db.sql
makes pg_upgrade fail as below:
olddump=/tmp/db.sql oldinstall=`pwd`/tmp_install/usr/local/pgsql PROVE_TESTS="t/002*" make -s check -C src/bin/pg_upgrade/
# Restoring database schemas in the new cluster
# *failure*
#
# Consult the last few lines of
".../src/bin/pg_upgrade/tmp_check/t_002_pg_upgrade_new_node_data/pgdata/pg_upgrade_output.d/20261129T172103.889/log/pg_upgrade_dump_16384.log"
for
# the probable cause of the failure.
# Failure, exiting
cat ".../pg_upgrade_dump_16384.log"
pg_restore: while PROCESSING TOC:
pg_restore: from TOC entry 3535; 0 0 COMMENT CONSTRAINT "parent_i_not_null" ON "child" law
pg_restore: error: could not execute query: ERROR: constraint "parent_i_not_null" for table "child" does not exist
Command was: COMMENT ON CONSTRAINT "parent_i_not_null" ON "public"."child" IS 'comment on child';
Best regards,
Alexander
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Tom Lane | 2026-11-29 16:47:25 | Re: btree_gist: <-> fails on same-sign infinite intervals |
| Previous Message | Pavan | 2026-11-29 15:02:17 | Re: BUG #19952: psql \d+ omits nondefault replica identity for partitioned tables |