| From: | Raja Sai pranav <rajasaipranav0(at)gmail(dot)com> |
|---|---|
| To: | zsolt(dot)parragi(at)percona(dot)com |
| Cc: | pgsql-bugs(at)lists(dot)postgresql(dot)org, exclusion(at)gmail(dot)com, alvherre(at)kurilemu(dot)de |
| Subject: | Re: BUG #19928: pg_upgrade fails on v18 schema with NOT NULL ... NO INHERIT and inheritance |
| Date: | 2026-12-01 04:50:50 |
| Message-ID: | CAPHduZD5-koStDBL-J=aEVT_34fWpMS4ZhR3jzEXL=g290zLxg@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-bugs |
On Mon, Nov 30, 2026 at 10:27 PM Zsolt Parragi <zsolt(dot)parragi(at)percona(dot)com>
wrote:
> We can create inheritance cycles like the following:
> [...]
> pg_dump -Fc / -s / --binary-upgrade: Segmentation fault (core dumped),
rc=139
Thanks for testing. I get the same crash. The walk up the ancestors
recursed without remembering where it had been. v4 keeps a list of the
tables already visited and looks at each one once. On your cycle
pg_dump now exits 0 with the same "could not resolve dependency loop"
warning as master.
> Only direct parents of dumped tables get their attributes loaded, so
> the walk stops at the first ancestor that is neither dumped nor a
> direct parent.
Right. v4 keeps walking through such an ancestor, since its own
ancestors may be dumped. With -t g -t c the post-data section now has
z_nn before a_nn and restores. Master fails on this case too.
> NO INHERIT ancestors change a restored name:
The patch made root's aa depend on branch's zz, which moved zz ahead
of mm. A NO INHERIT constraint never reaches the descendants, so v4
leaves those out. That needed one more change: determineNotNullFlags()
returned before setting notnull_noinh for invalid constraints, so it
now sets it first. Your example now restores leaf with mm, as in the
source.
A related case is wrong on master and with v4 alike: if other's
constraint is named zz and branch's is named mm, and other's is added
first, leaf has zz in the source but mm after restore, because the two
are restored in name order. Putting the creator first in general can
conflict with restoring a child's own constraint first and create
dependency loops, so I left that alone, like the partition case, which
I agree is separate.
I tried adding your third case to constraints.sql for the pg_upgrade
test, but that test passes with the v3 code too: leaf's constraint is
inherited, so it is not in the dumps the test compares. So v4 has no
new test.
With v4 the regression tests, the pg_dump TAP tests and the pg_upgrade
test pass, and the scenarios from my earlier mails give the same
results as with v3.
Regards,
Sai Pranav
| Attachment | Content-Type | Size |
|---|---|---|
| v4-0001-pg_dump-Restore-a-child-s-NOT-VALID-not-null-cons.patch | text/x-patch | 11.9 KB |
| v4-0002-pg_dump-Restore-comments-on-inherited-NOT-VALID-n.patch | text/x-patch | 8.4 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Michael Paquier | 2026-12-01 04:56:28 | Re: SIMILAR TO expressions translate wildcards where they shouldn't |
| Previous Message | Kirill Reshke | 2026-12-01 04:46:36 | Re: BUG #19936: Planning is slower on 19.0 with many partial indexes on a SQL function |