From: Álvaro Herrera <alvherre@kurilemu.de>
To: Andrew Bille <andrewbille@gmail.com>
Cc: Dilip Kumar <dilipbalaut@gmail.com>
Cc: David Rowley <dgrowleyml@gmail.com>
Cc: pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #19074: pg_dump from v18 loses the NOT NULL flag in the inherited table field when dumping v17-databases
Date: Sat, 18 Oct 2025 14:06:56 +0200
Message-ID: <202510181201.k6y75v2tpf5r@alvherre.pgsql> (raw)
In-Reply-To: <202510172049.2yfmpkb7al74@alvherre.pgsql>
By the way, while testing this, I ran into a pg_dump bug. In the object
sorting algorithm (DOTypeNameCompare), we fail to process objects of
type DO_FK_CONSTRAINT correctly (which is to say: identically to
DO_CONSTRAINT ones), so we fall back to compare by OID, and in debug
builds, the assertion at the bottom of the routine fires. The fix is
trivial:
diff --git a/src/bin/pg_dump/pg_dump_sort.c b/src/bin/pg_dump/pg_dump_sort.cindex a51064f21e3..0aec83bedb2 100644--- a/src/bin/pg_dump/pg_dump_sort.c+++ b/src/bin/pg_dump/pg_dump_sort.c@@ -328,7 +328,8 @@ DOTypeNameCompare(const void *p1, const void *p2)
if (cmpval != 0)
return cmpval;
}
- else if (obj1->objType == DO_CONSTRAINT)+ else if (obj1->objType == DO_CONSTRAINT ||+ obj1->objType == DO_FK_CONSTRAINT)
{
ConstraintInfo *robj1 = *(ConstraintInfo *const *) p1;
ConstraintInfo *robj2 = *(ConstraintInfo *const *) p2;
I'll apply this separately, because it goes back to 13 (commit
0decd5e89db9).
--
Álvaro Herrera Breisgau, Deutschland — https://www.EnterpriseDB.com/
"Computing is too important to be left to men." (Karen Spärck Jones)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-bugs@postgresql.org
Cc: alvherre@kurilemu.de, andrewbille@gmail.com, dilipbalaut@gmail.com, dgrowleyml@gmail.com, pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #19074: pg_dump from v18 loses the NOT NULL flag in the inherited table field when dumping v17-databases
In-Reply-To: <202510181201.k6y75v2tpf5r@alvherre.pgsql>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox