Excerpts from Todd Kover's message of mar ago 07 20:10:25 -0400 2012:

> Given this:
> ---<snip>---
> drop table IF EXISTS foo;
> drop table IF EXISTS foo_v26;
> 
> create table foo (id serial not null, bar integer );
> alter table foo alter column id drop default;
> 
> alter table foo rename to foo_v26;
> 
> create table foo (id integer not null, bar integer );
> 
> alter table foo alter id SET DEFAULT nextval('foo_id_seq');
> 
> drop table foo_v26;
> ---<snip>---
> 
> everthing works as expected until the final drop, which says:
> 
> jazzhands=> drop table foo_v26;
> ERROR:  cannot drop table foo_v26 because other objects depend on it
> DETAIL:  default for table foo column id depends on sequence foo_id_seq
> HINT:  Use DROP ... CASCADE to drop the dependent objects too.

I think you need an ALTER SEQUENCE .. OWNED BY to fix up dependencies
for the sequence.

-- 
Álvaro Herrera                http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services

-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs

Reply via email to