Re: CREATE TABLE initial value for PRIMARY KEY

Поиск
Список
Период
Сортировка
От Richard Broersma Jr
Тема Re: CREATE TABLE initial value for PRIMARY KEY
Дата
Msg-id 13265.79301.qm@web31810.mail.mud.yahoo.com
обсуждение исходный текст
Ответ на CREATE TABLE initial value for PRIMARY KEY  (Maurice Yarrow <yarrow@best.com>)
Ответы Re: CREATE TABLE initial value for PRIMARY KEY  (Maurice Yarrow <yarrow@best.com>)
Список pgsql-general
> I thought about  using a DEFAULT value, but I had presumed
> that this was only for repeated intializations.  So then is it the
> case that a
> CREATE TABLE mytable ( id INTEGER PRIMARY KEY DEFAULT 100000, ...
> only applies this default to the very first row of such a table, and then
> sensibly, increments from there ?
> (Guess I could easily try this out...)

Ah, I think I know what you are looking for. You want an auto-incrementing number. There are
special sudo-data-types called serial bigserial.  These are really auto-incrementing
integers/bigintegers. For more details on how to use this see:

http://www.postgresql.org/docs/8.1/interactive/datatype.html#DATATYPE-SERIAL

Also, when relying, don't forget to reply also to the list that way everyone can participate.

Regards,

Richard Broersma Jr.



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

Предыдущее
От: "Greg Quinn"
Дата:
Сообщение: Re: Problems running PostGreSQL silent install
Следующее
От: "Magnus Hagander"
Дата:
Сообщение: Re: Problems running PostGreSQL silent install