Re: Noob question: how to auto-increment index field on INSERT?

Поиск
Список
Период
Сортировка
От Thomas Kellerer
Тема Re: Noob question: how to auto-increment index field on INSERT?
Дата
Msg-id he45eh$549$1@ger.gmane.org
обсуждение исходный текст
Ответ на Re: Noob question: how to auto-increment index field on INSERT?  (Ken MacDonald <drken567@gmail.com>)
Список pgsql-novice
Ken MacDonald wrote on 19.11.2009 19:59:
> Thanks to all who replied so far. I agree that using the serial type
> would be ideal, and in fact set up a couple test DB's that way.
> Unfortunately, Django is auto-generating this field from its data
> models, and I don't seem to have much/any control over its type.
>
> Looking at pgadmin some more, it appears that column 'id' is set up with
> a default value of 'nextval('tablename_id_seq'::regclass)'.

Which is essentially what "serial" is: just a shorthand for the above construct

Thomas

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

Предыдущее
От: Ken MacDonald
Дата:
Сообщение: Re: Noob question: how to auto-increment index field on INSERT?
Следующее
От: Jasen Betts
Дата:
Сообщение: Re: My second PL/pgSQL function - minor problem