Re: serial drop error

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Ed L(dot)" <pgsql(at)bluepolka(dot)net>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: serial drop error
Date: 2004-12-05 19:54:38
Message-ID: 18150.1102276478@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

"Ed L." <pgsql(at)bluepolka(dot)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

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Ed L. 2004-12-05 19:56:07 Re: drop view race condition
Previous Message Ed Loehr 2004-12-05 19:53:15 drop view race condition