Re: Bug #785: 7.3b2 : Possible Inconsistency with DROP INDEX ... CASCADE and DROP CONSTRAINT

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: tim(at)ametco(dot)co(dot)uk, pgsql-bugs(at)postgresql(dot)org
Subject: Re: Bug #785: 7.3b2 : Possible Inconsistency with DROP INDEX ... CASCADE and DROP CONSTRAINT
Date: 2002-09-27 15:33:45
Message-ID: 3971.1033140825@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

pgsql-bugs(at)postgresql(dot)org writes:
> CREATE TABLE t1 (
> col_a int,
> PRIMARY KEY (col_a)
> );

> --DROP INDEX t1_pkey CASCADE WILL NOT CASCADE THE DROP TO DEPENDENT OBJECTS
> DROP INDEX t1_pkey CASCADE;

> --ALTER TABLE .. DROP .. CASCADE WILL CASCADE THE DROP TO THE FOREIGN KEY CONSTRAINT
> ALTER TABLE t1 DROP CONSTRAINT t1_pkey CASCADE;

This is deliberate: you created the index indirectly via a constraint,
so you should drop the constraint rather than dropping the index itself.
Essentially, the index is only an implementation detail that you should
not be messing with directly.

Or at least that was the design idea. If you think this is wrongheaded,
feel free to start a discussion about it on pghackers.

It might be that the behavior is okay but the error message should be
phrased differently in this case. Any thoughts?

regards, tom lane

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message roco 2002-09-27 18:49:47 FATAL 1: Database dialup does not exist in pg_database
Previous Message pgsql-bugs 2002-09-27 14:46:27 Bug #785: 7.3b2 : Possible Inconsistency with DROP INDEX ... CASCADE and DROP CONSTRAINT