Re: BUG #18917: "Foreign key constraint drop fails with 'column is not in index' unless pg_constraint is queried
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: samfelder17@gmail.com
Cc: pgsql-bugs@lists.postgresql.org
Date: 2025-05-08T01:50:34Z
Lists: pgsql-bugs
PG Bug reporting form <noreply@postgresql.org> 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