Re: Unable to drop a table due to seemingly non-existent dependencies

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: David Brain <dbrain(at)bandwidth(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Unable to drop a table due to seemingly non-existent dependencies
Date: 2009-09-10 18:55:18
Message-ID: 6400.1252608918@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

David Brain <dbrain(at)bandwidth(dot)com> writes:
> I have a situation where trying to drop a table results in:

> #drop table cdrimporterror_old;
> NOTICE: default for table cdrimporterror column cdrimporterrorid
> depends on sequence cdrimporterror_cdrimporterrorid_seq
> ERROR: cannot drop table cdrimporterror_old because other objects depend on it
> HINT: Use DROP ... CASCADE to drop the dependent objects too.

> Now as you can probably imply from the name if this table, this table
> has been renamed from cdrimporterror to cdrimporterorr_old and I have
> (or at least thought I had) removed it's dependency on the sequence by
> changing the tables column type (from bigserial to bingint) and
> removing the default value.

The "ownership" link is still there, evidently, and should be switched
to the new table. Read up on ALTER SEQUENCE OWNED BY.

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2009-09-10 19:01:41 Re: Getting the oid of an anyelement
Previous Message Richard Huxton 2009-09-10 18:52:07 Re: Unable to drop a table due to seemingly non-existent dependencies