"Ed L." <pgsql@bluepolka.net> writes:
> The following queries result in a dropped sequence, but IMO should not:
> create table foo(id serial);
> create table bar(id integer not null nextval('foo_id_seq'::text));
> alter table foo alter column id drop default;
> drop table foo;
I don't think that follows at all. The sequence is associated with the
column because of use of the "serial" declaration; dropping the default
expression doesn't change that.
If you want to use a single sequence to feed two different columns,
declare it as an object in its own right. If I were to change anything
at all about the above example, it would to find a way to disallow you
from referencing the foo.id sequence for bar.id, because you are poking
into the internals of the SERIAL abstraction when you do that.
regards, tom lane