Re: auto_increment
От | Bruno Wolff III |
---|---|
Тема | Re: auto_increment |
Дата | |
Msg-id | 20030922142243.GA23419@wolff.to обсуждение исходный текст |
Ответ на | Re: auto_increment (sad <sad@bankir.ru>) |
Список | pgsql-sql |
On Mon, Sep 22, 2003 at 09:15:04 +0400, sad <sad@bankir.ru> wrote: > On Saturday 20 September 2003 10:23, you wrote: > > On Sat, 2003-09-20 at 06:10, Muhyiddin A.M Hayat wrote: > > > How to Create auto_increment field in PostreSQL. > > > Can I create them using Trigger. > > > > Use the SERIAL datatype. See also the functions nextval(), currval() > > and setval(). > > I believe it is better to EXPLICITLY declare a SEQUENCE and > set the default value nextval() to the field. The disadvantage of that system is that the dependency isn't detected. With serial type you won't be able to drop the sequence without dropping the column and when you drop the table, the sequence will get dropped as well. (The preceding applies to 7.4. Things may not be checked as well in 7.3.)
В списке pgsql-sql по дате отправления: