Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1vA5iD-00DiTt-0B for pgsql-bugs@arkaria.postgresql.org; Sat, 18 Oct 2025 12:07:04 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1vA5iA-007eRW-RI for pgsql-bugs@arkaria.postgresql.org; Sat, 18 Oct 2025 12:07:01 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1vA5iA-007eRO-Aq for pgsql-bugs@lists.postgresql.org; Sat, 18 Oct 2025 12:07:01 +0000 Received: from fout-a8-smtp.messagingengine.com ([103.168.172.151]) by makus.postgresql.org with smtp (Exim 4.96) (envelope-from ) id 1vA5i7-002S2I-1u for pgsql-bugs@lists.postgresql.org; Sat, 18 Oct 2025 12:07:00 +0000 Received: from phl-compute-04.internal (phl-compute-04.internal [10.202.2.44]) by mailfout.phl.internal (Postfix) with ESMTP id 08284EC00FC; Sat, 18 Oct 2025 08:06:59 -0400 (EDT) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-04.internal (MEProxy); Sat, 18 Oct 2025 08:06:59 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kurilemu.de; h= cc:cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :reply-to:subject:subject:to:to; s=fm1; t=1760789219; x= 1760875619; bh=NJbIlfZ5DrjMtOzzGWWSXMtUvvTT20+kzABx5iGZF5s=; b=k kgKJ5ETqvukRvz3+oDPJWUwelPpz1P6GVqeQnevYLvrqnvOK7xQpZYrAhg2LWfSj axohtYbun/nn97N8cOBQMFnd3EHcRgBBcditY1SEhrSXqyISSTv7JT50wwVjnKWw VfCSNs/5lemA+iZJlDL3aH/c20rLKAuKup/sx8Qy2lbZcxRJJCH80H3Zv8mKPS8g ETaJb7dkbTGuvJotW+SaZGH3OrQEbRbIQ/VYlxN5p3IBG+MCgYnc+3fT/Bce7eq0 j21YfiRPPsI7WOuUDr8o6C8oj+OZadAhhkvzYdoMay9CR2SQcKLANhw5Srt5rRBT 5ugPh7NH3ELowJ06n+tow== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :reply-to:subject:subject:to:to:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm2; t=1760789219; x=1760875619; bh=N JbIlfZ5DrjMtOzzGWWSXMtUvvTT20+kzABx5iGZF5s=; b=walbkflbp9KqRF7j5 yCpym8DbhaXdBQAAB65my7R+Z08khH71uh4QdCO52NinSmjduNNi1SCWA1hQ/Jq6 /nJaCMzXwlwzYz5DiWZyQN46a7CI8rDDt5qLdLST+lv+6imG4BlkECXT8xpOrqQC ykSKqvz6q9BQRJNqGBXA5H/419AbMz4E5X4miffzpek7ByKvdspzFoYFxAT75m9q EJneFYAgin33DX8oIUqQjmUR4UaRrz2sf4gty4kueM5MMjExjxf2VGcphb0WZ35j nODMBz8kz1UQxIfqbmh2myLQ1SqTPXh7BeN5BOdlKgDKNDKfYTvfLLm7wC6gWQOO +ev5w== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtdeggddufedvtddtucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujf gurhepfffhvfevuffkgggtugfgjgesthekredttddtjeenucfhrhhomheplmhlvhgrrhho ucfjvghrrhgvrhgruceorghlvhhhvghrrhgvsehkuhhrihhlvghmuhdruggvqeenucggtf frrghtthgvrhhnpeetuedvheffkeevgfeuheevteevkefggedttdeufeeuheduuddthfef fffhjeefffenucffohhmrghinhepvghnthgvrhhprhhishgvuggsrdgtohhmnecuvehluh hsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomheprghlvhhhvghrrhgv sehkuhhrihhlvghmuhdruggvpdhnsggprhgtphhtthhopeegpdhmohguvgepshhmthhpoh huthdprhgtphhtthhopegrnhgurhgvfigsihhllhgvsehgmhgrihhlrdgtohhmpdhrtghp thhtohepughgrhhofihlvgihmhhlsehgmhgrihhlrdgtohhmpdhrtghpthhtohepughilh hiphgsrghlrghuthesghhmrghilhdrtghomhdprhgtphhtthhopehpghhsqhhlqdgsuhhg sheslhhishhtshdrphhoshhtghhrvghsqhhlrdhorhhg X-ME-Proxy: Feedback-ID: ie3de48e3:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sat, 18 Oct 2025 08:06:58 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kurilemu.de; s=schmee; t=1760789216; bh=4SOWdaft7IOtRiqTnvv8ax7EBMR5J5tGKR3uoCVPsn0=; h=Date:From:To:Cc:Subject:In-Reply-To:From; b=WH0F7zkidwwSZLZ0xkJzazjis2WCRH9Amvpd1EoqwgtO/oEYR4V8qM53WYaiB+ISi 8Qi6R1CoWWYdyVFusv9yhU2CU7XM+qmm1aMZALE/O627bxEvQBZGiJBVHi9wBQqU7B XuprM/0KlAci2r+xCp6jFfS9zrAMdl6TEksUMRTkKeCowVIAifkICNu5rrVOFWi8gl eZm2JFfA040l1RSCLWCabklLTvvc/Ddc2fNMJU+Vv1r/llEnMeeX3evKC/62gpdyF+ lMO0ZduIhlMcVmkjx4yV/tcVSV6U/ZvcggRyzT5ncmuYweRHv6qMoryB48KJcf5ho9 XeYuu3uOA492A== Received: by schmee.kurilemu.internal (Postfix, from userid 1000) id 21DA876; Sat, 18 Oct 2025 14:06:56 +0200 (CEST) Date: Sat, 18 Oct 2025 14:06:56 +0200 From: =?utf-8?Q?=C3=81lvaro?= Herrera To: Andrew Bille Cc: Dilip Kumar , David Rowley , 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 Message-ID: <202510181201.k6y75v2tpf5r@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <202510172049.2yfmpkb7al74@alvherre.pgsql> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk 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.c index 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)