DROP INDEX CASCADE doesn't want to drop unique constraints?

From: Ivan Voras <ivoras(at)gmail(dot)com>
To: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: DROP INDEX CASCADE doesn't want to drop unique constraints?
Date: 2017-04-24 12:11:59
Message-ID: CAF-QHFXWM2aqb_Lt-qfC8ZQvd8NchdbtsnH8j23w67CjzN0Bfw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hello,

On trying to drop an index named "employer_employerid_key" which supports a
unique constraint:

"employer_employerid_key" UNIQUE CONSTRAINT, btree (employerid)

I get this error:

ERROR: cannot drop index employer_employerid_key because constraint
employer_employerid_key on table employer requires it
HINT: You can drop constraint employer_employerid_key on table employer
instead.

I'm using the CASCADE and IF EXISTS arguments and the docs say nothing
about any special cases (
https://www.postgresql.org/docs/9.3/static/sql-dropindex.html). This is
with PostgreSQL 9.3.15.

The actual command is:

drop index if exists employer_employerid_key cascade;

Any ideas if this is normal or why it happens?

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Andreas Kretschmer 2017-04-24 12:38:14 Re: DROP INDEX CASCADE doesn't want to drop unique constraints?
Previous Message dhaval jaiswal 2017-04-24 10:09:29 Re: Memory consumption for Query