Re: Re: drop table problem

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: frank_lupo <frank_lupo(at)email(dot)it>
Cc: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: Re: drop table problem
Date: 2003-01-25 16:29:15
Message-ID: 11008.1043512155@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

"=?utf-8?Q?frank=5Flupo?=" <frank_lupo(at)email(dot)it> writes:
>> "=3D?utf-8?Q?frank=3D5Flupo?=3D" writes:=0D=0A> > If create a table and alter column add sequence. The relation on table and =3D=0D=0A> > sequence is not present in pg_depend.=0D=0A> =0D=0A> What are you doing, exactly? ADD COLUMN foo SERIAL doesn't work yet.=0D=0A> =0D=0A> regression=3D# alter table vv add column f2 serial;=0D=0A> NOTICE: ALTER TABLE will create implicit sequence 'vv_f2_seq' for SERIAL column 'vv.f2'=0D=0A> ERROR: Adding columns with defaults is not implemented.=0D=0A> Add the column, then use ALTER TABLE SET DEFAULT.=0D=0A> =0D=0A> SET DEFAULT nextval('foo') does not create an auto-drop dependency,=0D=0A> and should not IMHO.=0D=0A> =0D=0A> regards, tom lane=0D=0A> =0D=0A=0D=0AAn other problem and that if I create a table p1 with a field sequence and this sequence I associate it to one other table p2, when drop p1 the table p2 remains without sequence.=0D=0A=0D=0ATanks=0A=0ABye !!=0AFrank Lupo (Wolf) !!=0A=0A /\_ _/\=0A \ o o /=!
0A--ooo---

Might I ask you to stop MIME-encoding your mail?

Anyway, I think you're misusing serial sequences. If you create a
sequence "foo" and then use DEFAULT nextval('foo') for some tables,
then the sequence is an independent object and should *not* go away
when the tables are removed. If you declare a column as SERIAL, then
the fact that there is a sequence behind that is an implementation
detail --- you have no business messing with that sequence directly.

Having said that, it'd be good if nextval('foo') created an ordinary
(not auto-drop) dependency from the expression to the sequence foo.
That's not implemented yet, but we're thinking about it.

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tilo Schwarz 2003-01-25 16:45:13 Documentation improvement suggestions
Previous Message Tilo Schwarz 2003-01-25 15:57:14 Re: Is there a way knowing which database I'm connecting to?