Error "cannot drop table xxx because other objects depend on it" even if there is no view, function, trigger, etc associated with it
search cancel

Error "cannot drop table xxx because other objects depend on it" even if there is no view, function, trigger, etc associated with it

book

Article ID: 296870

calendar_today

Updated On:

Products

VMware Tanzu Greenplum

Issue/Introduction

Sometimes when dropping a table, the error "cannot drop table xxx because other objects depend on it" is still reported even if we have confirmed there is no view, function,etc. depending on it.

In most cases, this should be due to the fact that some other table(s) is inheriting the table to be dropped.

Environment

Product Version: 6.22

Resolution

Basically, we have 2 options:
  • Drop the child table. We can use the catalog table pg_inherits to identify the parent and child tables, and then drop all the child tables. Please remember to double check beforehand if we still need the data on these child tables.
  • Remove the inheritance relationship. By then, the child table should be still performing as an independent table. Here below is an example to remove the table inheritance relationship by assuming table A is the Parent and table B is the Child:
alter table B no inherit A;
After the above-mentioned operations, the table should be able to be dropped.