Re: drop operator class..using .. left dependency behind.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Rajkumar Raghuwanshi <rajkumar(dot)raghuwanshi(at)enterprisedb(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: drop operator class..using .. left dependency behind.
Date: 2017-06-19 14:17:21
Message-ID: 27704.1497881841@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Rajkumar Raghuwanshi <rajkumar(dot)raghuwanshi(at)enterprisedb(dot)com> writes:
> I have observed that even after dropping operator class, not able to drop
> schema containing it. below is a example.

You didn't read the error message closely:

> *postgres=# DROP SCHEMA sch_test;ERROR: cannot drop schema sch_test
> because other objects depend on itDETAIL: operator family
> sch_test.custom_opclass_test for access method hash depends on schema
> sch_testHINT: Use DROP ... CASCADE to drop the dependent objects too.*

The operator class is gone, but the operator family that contained it
still exists. CREATE OPERATOR CLASS will create a containing family
if you don't specify one, but DROP OPERATOR CLASS won't automatically
remove such a family. (If it did, it might destroy other operator
classes that had been added to that family later.)

Probably the easiest answer is to use DROP OPERATOR FAMILY instead.

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2017-06-19 14:31:04 Re: Setting pd_lower in GIN metapage
Previous Message Fabrízio de Royes Mello 2017-06-19 14:12:51 Re: Directory pg_replslot is not properly cleaned