invisible dependencies on a table? - Mailing list pgsql-general

From Tim Uckun
Subject invisible dependencies on a table?
Date
Msg-id CAGuHJrPC4UCXRmsUUhnS0ykCdCPspv9TkKjg=OMCznyUuALZFQ@mail.gmail.com
Whole thread Raw
Responses Re: invisible dependencies on a table?  (David Johnston <polobo@yahoo.com>)
Re: invisible dependencies on a table?  (Adrian Klaver <adrian.klaver@gmail.com>)
List pgsql-general
I have a table foo. It has a serial column called "id".  I execute the following statement

ALTER TABLE table_name RENAME TO  archived_table_name;
          CREATE TABLE table_name (LIKE archived_table_name INCLUDING DEFAULTS       INCLUDING CONSTRAINTS INCLUDING INDEXES);

..... Archieve the table here...

DROP TABLE arhived_table_name

This doesn't work because the archived table name has a dependency on the sequence created by the serial field.  So I try to remove that dependency by doing this.

alter table "archived_table_name" alter column id drop default;
 ALTER TABLE"archived_table_name"  DROP CONSTRAINT systemevents_pkey;

So by now there should not be a dependency on the sequence but I still can't drop the table and and pgadmin tells me it's still depending on the sequence.

When I look at the table definition it doesn't seem to have any reference to the sequence at all.

How can I drop this table and leave the sequence alone? Obviously the newly created table needs it.

Thanks.

pgsql-general by date:

Previous
From: John Melesky
Date:
Subject: Re: Zero dead tuples, when significant apparent bloat
Next
From: David Johnston
Date:
Subject: Re: invisible dependencies on a table?