From: | Eric McKeeth <eldin00(at)gmail(dot)com> |
---|---|
To: | JORGE MALDONADO <jorgemal1960(at)gmail(dot)com> |
Cc: | pgsql-novice(at)postgresql(dot)org |
Subject: | Re: SERIAL FIELD SEQUENCE MAXIMUM VALUE |
Date: | 2010-02-28 00:13:49 |
Message-ID: | 4bef63731002271613x1a082d52tc725c89d2365704a@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-novice |
On Sat, Feb 27, 2010 at 4:43 PM, JORGE MALDONADO <jorgemal1960(at)gmail(dot)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
From | Date | Subject | |
---|---|---|---|
Next Message | Bruce Momjian | 2010-02-28 01:42:02 | Re: Browsing through the Postgres source |
Previous Message | Mladen Gogala | 2010-02-28 00:07:36 | Browsing through the Postgres source |