Re: serial drop error - Mailing list pgsql-bugs

From Tom Lane
Subject Re: serial drop error
Date
Msg-id 18150.1102276478@sss.pgh.pa.us
Whole thread Raw
In response to serial drop error  ("Ed L." <pgsql@bluepolka.net>)
List pgsql-bugs
"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

pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: Configure error on Openssl with Beta5
Next
From: "Ed L."
Date:
Subject: Re: drop view race condition