I'm just getting around to dropping the sequence on my table (after a
hiatus)...
> I would expect that you would first need to
>
> ALTER TABLE ... COLUMN ... DROP DEFAULT
>
> to remove the dependency on the sequence. Then drop sequence should work.
That doesn't seem to work, strangely -- I've executed the following command:
ALTER TABLE news ALTER COLUMN news_id DROP DEFAULT
Fine, and now my table looks like this:
be_db=# \d news;
Table "public.news"
+-[ RECORD 1 ]----------------------------+
| Column | news_id |
| Type | integer |
| Modifiers | not null |
+-[ RECORD 2 ]----------------------------+
| Column | news_date |
| Type | timestamp without time zone |
| Modifiers | not null |
+-[ RECORD 3 ]----------------------------+
| Column | expire_date |
| Type | date |
| Modifiers | not null |
+-[ RECORD 4 ]----------------------------+
| Column | news_title |
| Type | character varying(64) |
| Modifiers | not null default '' |
+-[ RECORD 5 ]----------------------------+
| Column | news_info |
| Type | text |
| Modifiers | not null |
+-[ RECORD 6 ]----------------------------+
| Column | user_id |
| Type | integer |
| Modifiers | not null |
+-----------+-----------------------------+
Indexes: news_pkey primary key btree (news_id)
Foreign Key constraints: $1 FOREIGN KEY (user_id) REFERENCES
users(user_id) ON UPDATE NO ACTION ON D
ELETE NO ACTION
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
You may drop table news column news_id instead
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?
Erik