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

Search Discussions

  • Eric McKeeth at Feb 28, 2010 at 12:14 am

    On Sat, Feb 27, 2010 at 4:43 PM, JORGE MALDONADO 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

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppgsql-novice @
categoriespostgresql
postedFeb 27, '10 at 11:43p
activeFeb 28, '10 at 12:14a
posts2
users2
websitepostgresql.org
irc#postgresql

2 users in discussion

JORGE MALDONADO: 1 post Eric McKeeth: 1 post

People

Translate

site design / logo © 2022 Grokbase