Re: dropping sequences

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Erik Price <eprice(at)ptc(dot)com>
Cc: PostgreSQL-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: dropping sequences
Date: 2003-06-28 03:05:58
Message-ID: 15125.1056769558@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Erik Price <eprice(at)ptc(dot)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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2003-06-28 03:29:43 Re: PlPython
Previous Message Martijn van Oosterhout 2003-06-28 01:10:35 Re: [BUGS] Problem with duplicate file.