Re: dropping sequences - Mailing list pgsql-general

From Tom Lane
Subject Re: dropping sequences
Date
Msg-id 15125.1056769558@sss.pgh.pa.us
Whole thread Raw
In response to Re: dropping sequences  (Erik Price <eprice@ptc.com>)
List pgsql-general
Erik Price <eprice@ptc.com> writes:
> But when I try to drop the sequence altogether:

> be_db=# DROP SEQUENCE news_news_id_seq;
> ERROR:  Cannot drop sequence news_news_id_seq because table news column
> news_id requires it

That's intentional: the sequence is part of the implementation of a
serial column, and you should not be able to remove it separately.
(You really shouldn't be able to dork with the column's DEFAULT
expression either, but we don't currently have a way to enforce that.)

> Anybody have a suggestion?  I just want to remove these sequences from
> the database altogether.  Am I going to have to drop the news_id column
> altogether?

If you are really intent on deconstructing the sequence mechanism for
this column, you could find and delete the pg_depend row that represents
the dependency.  Details are left as an exercise for the student ...

            regards, tom lane

pgsql-general by date:

Previous
From: Martijn van Oosterhout
Date:
Subject: Re: [BUGS] Problem with duplicate file.
Next
From: Tom Lane
Date:
Subject: Re: PlPython