Re: SERIAL FIELD SEQUENCE MAXIMUM VALUE

Поиск
Список
Период
Сортировка
От Eric McKeeth
Тема Re: SERIAL FIELD SEQUENCE MAXIMUM VALUE
Дата
Msg-id 4bef63731002271613x1a082d52tc725c89d2365704a@mail.gmail.com
обсуждение исходный текст
Ответ на SERIAL FIELD SEQUENCE MAXIMUM VALUE  (JORGE MALDONADO <jorgemal1960@gmail.com>)
Список pgsql-novice
On Sat, Feb 27, 2010 at 4:43 PM, JORGE MALDONADO <jorgemal1960@gmail.com> wrote:
I have several tables with serial and bigserial field types. I ran pgAdmin III and checked the sequences values and I see that all of them have the same maximum; serial and bigserial maximum value is 9223372036854775807.
Why do serial and bigserial fields take the same maximum values?
Isn't it supposed that serial maximum value should be 2147483647?
 
Respectfully,
Jorge Maldonado

You're confusing the serial/bigserial columns with the sequences that populate them. Serial and bigserial are just shortcuts to create an integer/bigint and a sequence to use as it's default value. The sequence is just like a sequence created separately, and has no knowledge of what sort of column it's values will be inserted into, so it can return the full range of values that any sequence can return. The serial or bigserial columns however, will still only be able to store the maximum values for an int or a bigint respectively, so if you ever do insert enough records into a serial column, the sequence could return a value that results in an overflow error.

Hope that helps to answer your question.

Eric McKeeth

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

Предыдущее
От: JORGE MALDONADO
Дата:
Сообщение: SERIAL FIELD SEQUENCE MAXIMUM VALUE
Следующее
От: Mladen Gogala
Дата:
Сообщение: Browsing through the Postgres source