Thread: Re: drop table problem
> "frank_lupo" writes:
> > If create a table and alter column add sequence. The relation on table and =
> > sequence is not present in pg_depend.
>
> What are you doing, exactly? ADD COLUMN foo SERIAL doesn't work yet.
>
> regression=# alter table vv add column f2 serial;
> NOTICE: ALTER TABLE will create implicit sequence 'vv_f2_seq' for SERIAL column 'vv.f2'
> ERROR: Adding columns with defaults is not implemente d.
0D > Add the column, then use ALTER TABLE SET DEFAULT.
>
> SET DEFAULT nextval('foo') does not create an auto-drop dependency,
> and should not IMHO.
>
> regards, tom lane
>
An 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.
Tanks
"=?utf-8?Q?frank=5Flupo?=" <frank_lupo@email.it> writes: >> "=3D?utf-8?Q?frank=3D5Flupo?=3D" writes:=0D=0A> > If create a table and alter column add sequence. The relation on tableand =3D=0D=0A> > sequence is not present in pg_depend.=0D=0A> =0D=0A> What are you doing, exactly? ADD COLUMN foo SERIALdoesn't work yet.=0D=0A> =0D=0A> regression=3D# alter table vv add column f2 serial;=0D=0A> NOTICE: ALTER TABLE willcreate 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') doesnot create an auto-drop dependency,=0D=0A> and should not IMHO.=0D=0A> =0D=0A> regards, tom lane=0D=0A> =0D=0A=0D=0AAnother problem and that if I create a table p1 with a field sequence and this sequence I associate it to oneother 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