Re: Re: drop table problem

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Re: drop table problem
Дата
Msg-id 11008.1043512155@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: drop table problem  ("frank_lupo" <frank_lupo@email.it>)
Список pgsql-general
"=?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

В списке pgsql-general по дате отправления:

Предыдущее
От: Tilo Schwarz
Дата:
Сообщение: Re: Is there a way knowing which database I'm connecting to?
Следующее
От: Tilo Schwarz
Дата:
Сообщение: Documentation improvement suggestions