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 1u7bIN-002KbQ-3k for pgsql-bugs@arkaria.postgresql.org; Wed, 23 Apr 2025 14:41:51 +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 1u7bIK-006wed-6S for pgsql-bugs@arkaria.postgresql.org; Wed, 23 Apr 2025 14:41:49 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1u7bIJ-006weV-UP for pgsql-bugs@lists.postgresql.org; Wed, 23 Apr 2025 14:41:48 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1u7bIH-001c9S-0v for pgsql-bugs@postgresql.org; Wed, 23 Apr 2025 14:41:48 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 53NEfeE71344635; Wed, 23 Apr 2025 10:41:40 -0400 From: Tom Lane To: Alvaro Herrera cc: Kirill Reshke , pgsql-bugs@postgresql.org Subject: Re: Command order bug in pg_dump In-reply-to: <202504231301.ln7igwajlzu6@alvherre.pgsql> References: <202504231301.ln7igwajlzu6@alvherre.pgsql> Comments: In-reply-to Alvaro Herrera message dated "Wed, 23 Apr 2025 15:01:16 +0200" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1344633.1745419300.1@sss.pgh.pa.us> Date: Wed, 23 Apr 2025 10:41:40 -0400 Message-ID: <1344634.1745419300@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Alvaro Herrera writes: > I think the new constraint names are better, so +1 for this version of > the patch for 18. I agree that we don't necessarily want to backpatch > this to stable branches though. Cool, I'll push that patch in a bit then. > I wonder if it would make pg_upgrade users' lives easier if we had > pg_upgrade --check notify them about possible collisions on these > constraints (for the older branches). I don't have good ideas on how to > implement that though other than a trial dump/restore, which is perhaps > unreasonable. Yeah, I'm not seeing a simple way to do that either. I'm hesitant to put a ton of work into it, because in the end the situation seems like self-inflicted damage. It's not quite true that you need duplicate foreign key constraints to hit this, but it's close: the default table-and-column-name-based name for one constraint has to match the actual name of a second constraint. If the second constraint isn't a duplicate of the first then it has a very misleadingly chosen name. Either way it's pretty poor DBA practice. Between that thought and the fact that the problem has gone unnoticed since v12, I'm content to make this change in the default names and stop here. regards, tom lane