Skip site navigation (1) Skip section navigation (2)

Re: type "serial" and biginteger

From: Merlin Moncure <mmoncure(at)gmail(dot)com>
To: DFE <mimmopasticcio(at)gmail(dot)com>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: type "serial" and biginteger
Date: 2011-09-27 15:57:01
Message-ID: CAHyXU0xdigiVewFri9HaMk12xBZby+p+hA8iXt6NnfKf+E6OJQ@mail.gmail.com (view raw or flat)
Thread:
Lists: pgsql-novice
On Tue, Sep 27, 2011 at 5:16 AM, DFE <mimmopasticcio(at)gmail(dot)com> wrote:
> Hi all,
> I create a table with Primary Key with name "gid" and type SERIAL.
> I have a dubt on the SERIAL type: this data type is a INTEGER (int4)
> type, but the sequence that is automatically created with pgAdmin has
> BIGINTEGER output (MAXVALUE 9223372036854775807).
> This fact can cause a numeric overflow during the insert?

yup -- if you're really worried about this, use BIGSERIAL.  you could
in theory cap the sequence, but you'd just be trading one error for
another.

merlin

In response to

pgsql-novice by date

Next:From: Nomeneta SailiDate: 2011-09-28 03:23:12
Subject: PostgreSQL ANSI OBDC Installation
Previous:From: Tom LaneDate: 2011-09-27 13:58:19
Subject: Re: plperl.so no such file or directory

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group