Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oWbIr-0007Fu-6P for pgsql-hackers@arkaria.postgresql.org; Fri, 09 Sep 2022 10:32:05 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1oWbIq-0006Kb-3n for pgsql-hackers@arkaria.postgresql.org; Fri, 09 Sep 2022 10:32:04 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oWbIp-0006JH-2p for pgsql-hackers@lists.postgresql.org; Fri, 09 Sep 2022 10:32:03 +0000 Received: from out3-smtp.messagingengine.com ([66.111.4.27]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oWbIi-0008Nl-EN for pgsql-hackers@postgresql.org; Fri, 09 Sep 2022 10:32:02 +0000 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id EC47C5C00C5; Fri, 9 Sep 2022 06:31:52 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Fri, 09 Sep 2022 06:31:52 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:reply-to:sender :subject:subject:to:to:x-me-proxy:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm2; t=1662719512; x=1662805912; bh=W Fwyu2/DJHBaOsuJfsQpUOXrD1Z7V9z7UYWtG6OxH+o=; b=W05QNTl4rbgkAyPfq wxRL8OFG8vCQbnVVPAgeYPrDcjuEP3mIVoRpZmWtN1A+4Gie9mWpu2TlaJNV1CVJ BVBnjq60ZGs8mnUsJ7Jj8BAcmh4oeKAqnHUX/e4N/6OoorDaW1AEcJZH27eV9zA8 0HcZ4oIoSozh2rvsTH+xG3445nU/1FqMOFwA5Rrnm8LhYVMTmt64mPZOwLRy65wi 6KFD/+JQ9eM1pcLuSW7iZiipI/CGSmtm0H9eFzByhtKC+KHXKnHpH2CRhpWFfv3e /vPu4kY/sNT3RE8OWW74B030VTDJFU1vTv4bFfLgv1pZXtEWOGLBzz8QQkofBuP1 1JPlA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrfedthedgfedtucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvfevuffkgggtugfgjgesthekredttddtjeenucfhrhhomheptehlvhgr rhhoucfjvghrrhgvrhgruceorghlvhhhvghrrhgvsegrlhhvhhdrnhhoqdhiphdrohhrgh eqnecuggftrfgrthhtvghrnhepvdektdffudfftdffffehfffhjeejhffgieeuueekjeek fffgudffhfduffffueevnecuffhomhgrihhnpegvnhhtvghrphhrihhsvggusgdrtghomh enucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegrlhhv hhgvrhhrvgesrghlvhhhrdhnohdqihhprdhorhhg X-ME-Proxy: Feedback-ID: ia2694551:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 9 Sep 2022 06:31:52 -0400 (EDT) Received: by perhan.alvh.no-ip.org (Postfix, from userid 1000) id EC924389; Fri, 9 Sep 2022 12:31:49 +0200 (CEST) Date: Fri, 9 Sep 2022 12:31:49 +0200 From: Alvaro Herrera To: Amit Langote Cc: Tom Lane , Andres Freund , Jehan-Guillaume de Rorthais , pgsql-hackers Subject: Re: [BUG] wrong FK constraint name when colliding name on ATTACH Message-ID: <20220909103149.lk5n3vvb2taxejfp@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 2022-Sep-09, Amit Langote wrote: > Yes, the loop in GetForeignKeyActionTriggers() needs this: > > + /* Only ever look at "action" triggers on the PK side. */ > + if (RI_FKey_trigger_type(trgform->tgfoid) != RI_TRIGGER_PK) > + continue; > > Likewise, GetForeignKeyActionTriggers() needs this: > > + /* Only ever look at "check" triggers on the FK side. */ > + if (RI_FKey_trigger_type(trgform->tgfoid) != RI_TRIGGER_FK) > + continue; > > We evidently missed this in f4566345cf40b0. Ouch. Thank you, pushed. > On Fri, Sep 9, 2022 at 4:54 AM Tom Lane wrote: > > I'd counsel dropping the early-exit optimization; it doesn't > > save much I expect, and it evidently hides bugs. Or maybe > > make it conditional on !USE_ASSERT_CHECKING. > > While neither of these functions are called in hot paths, I am > inclined to keep the early-exit bit in non-assert builds. I kept it that way. -- Álvaro Herrera Breisgau, Deutschland — https://www.EnterpriseDB.com/ "El hombre nunca sabe de lo que es capaz hasta que lo intenta" (C. Dickens)