Re: alter table serial->int

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Erik Aronesty" <erik(at)q32(dot)com>
Cc: pgsql-admin(at)postgresql(dot)org
Subject: Re: alter table serial->int
Date: 2007-11-11 15:37:11
Message-ID: 18969.1194795431@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

"Erik Aronesty" <erik(at)q32(dot)com> writes:
> alter table x alter a set default 999;

> still doesn't help.

Doesn't help what?

If you mean that the sequence object is still there, you can drop that too.

regression=# create table x(a serial not null);
NOTICE: CREATE TABLE will create implicit sequence "x_a_seq" for serial column "x.a"
CREATE TABLE
regression=# drop sequence x_a_seq;
NOTICE: default for table x column a depends on sequence x_a_seq
ERROR: cannot drop sequence x_a_seq because other objects depend on it
HINT: Use DROP ... CASCADE to drop the dependent objects too.
regression=# alter table x alter a set default 999;
ALTER TABLE
regression=# drop sequence x_a_seq;
DROP SEQUENCE
regression=# \d x
Table "public.x"
Column | Type | Modifiers
--------+---------+----------------------
a | integer | not null default 999

regards, tom lane

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Carol Walter 2007-11-12 14:22:35 Security Query
Previous Message Erik Aronesty 2007-11-11 12:15:01 Re: alter table serial->int