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 1uCqPK-0032Yf-MT for pgsql-bugs@arkaria.postgresql.org; Thu, 08 May 2025 01:50:43 +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 1uCqPI-000XlH-NO for pgsql-bugs@arkaria.postgresql.org; Thu, 08 May 2025 01:50:40 +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 1uCqPI-000Xl9-F8 for pgsql-bugs@lists.postgresql.org; Thu, 08 May 2025 01:50:40 +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 1uCqPF-000jZV-1z for pgsql-bugs@lists.postgresql.org; Thu, 08 May 2025 01:50:40 +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 5481oYV1104862; Wed, 7 May 2025 21:50:34 -0400 From: Tom Lane To: samfelder17@gmail.com cc: pgsql-bugs@lists.postgresql.org Subject: Re: BUG #18917: "Foreign key constraint drop fails with 'column is not in index' unless pg_constraint is queried In-reply-to: <18917-fea6ac4ccec4e24a@postgresql.org> References: <18917-fea6ac4ccec4e24a@postgresql.org> Comments: In-reply-to PG Bug reporting form message dated "Thu, 08 May 2025 01:23:53 -0000" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <104860.1746669034.1@sss.pgh.pa.us> Date: Wed, 07 May 2025 21:50:34 -0400 Message-ID: <104861.1746669034@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk PG Bug reporting form writes: > when trying to drop a foreign key constraint with an existing index that > hasn't been used, you need to make a query against constraint table to get > it working. see below for psql sequence of events > ``` > mydb=> begin; > BEGIN > mydb=*> CREATE INDEX IF NOT EXISTS "child_table_parent_id_idx" ON > "child_table"("parent_id"); > CREATE INDEX > ... etc ... This test case is incomplete on its face. (How was the table created? Where did "child_table_parent_id_fkey" come from?) So it's hard to tell what's going on, much less fix it. Could we have a complete reproducer starting from an empty database? regards, tom lane