Re: BUG #19928: pg_upgrade fails on v18 schema with NOT NULL ... NO INHERIT and inheritance

From: Raja Sai pranav <rajasaipranav0(at)gmail(dot)com>
To: Heikki Linnakangas <hlinnaka(at)iki(dot)fi>
Cc: exclusion(at)gmail(dot)com, 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-26 09:53:31
Message-ID: CAPHduZBXeT57X8KS0wDWUDjowPyAoiOFdYA8XonHC4JVqUHZ5g@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On 26/11/2026 09:32, Heikki Linnakangas wrote:
> REL_18_STABLE does have this check too, it runs on a same-version
> upgrade. But _why_ do we run that check on a 18->18 upgrade? The
> scenario it's checking for should not be possible on a v18 cluster.

You're right, and I was wrong about REL_18_STABLE: the check is there, with
the same <= 1800 guard.

I tested the scenario on 18.7: dropping the not-null constraint of a child
column whose parent has an inheritable one fails with "cannot drop
inherited constraint", and a NOT VALID constraint added on the parent gives
the child a matching one. So I found no way to reach that state on v18.

> So I think this needs to be backpatched to REL_18_STABLE too, and the
> version guard should be fixed to:
> [...]
> And once you do that, you don't need to change the query in
> check_for_not_null_inheritance() anymore, the query is correct for
> pre-18 clusters. So all we need to do is fix that version guard.

With only that change, pg_upgrade --check from 18.7 to master passes on the
NO INHERIT schema from the report, and the full upgrade works. A PG 14
cluster with a real inconsistency (a child column whose NOT NULL was
dropped) is still reported, and a clean PG 14 cluster passes.

v2 attached: just your version guard change, with a commit message. It
applies to master and to REL_18_STABLE. There is still no test, since the
same-version pg_upgrade tests no longer reach the check.

Regards,
Sai Pranav

Attachment Content-Type Size
v2-0001-pg_upgrade-Dont-run-the-not-null-inheritance-check-on-v18.patch application/octet-stream 1.5 KB

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Raja Sai pranav 2026-11-26 09:59:29 Re: BUG #19928: pg_upgrade fails on v18 schema with NOT NULL ... NO INHERIT and inheritance
Previous Message Heikki Linnakangas 2026-11-26 09:32:05 Re: BUG #19928: pg_upgrade fails on v18 schema with NOT NULL ... NO INHERIT and inheritance