Re: Auto Increment Questions

Поиск
Список
Период
Сортировка
От Jeffrey Melloy
Тема Re: Auto Increment Questions
Дата
Msg-id 42B1C469.3050405@visualdistortion.org
обсуждение исходный текст
Ответ на Auto Increment Questions  ("Michael Avila" <mavila@mich.com>)
Список pgsql-novice
Michael Avila wrote:

>In Postgres I see that it is not so automatic and is not truly
>serial/sequential. Reviewing my objectives, I don't think not being truly
>serial/sequential will be a problem.
>
Are you saying that since serial isn't guaranteed to be 1,2,3,4,5
without gaps there will be a problem?

You can't just do something like "select max(val) + 1 from table" to get
the next serial value.  You need to do "select nextval(sequence)" and
then use "currval(sequence)" to get the current value.

If you don't care what the inserted value is, just use the DEFAULT
keyword in your inserts.

More information can be found in the manual.

Jeff

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

Предыдущее
От: "Mace, Richard"
Дата:
Сообщение: unsubscribe
Следующее
От: Jeffrey Melloy
Дата:
Сообщение: Re: Library Framework