If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > PostgreSQL > Serial and BigSerial maxvalues

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 09-28-11, 18:06
JORGEMAL JORGEMAL is offline
Registered User
 
Join Date: Apr 2011
Posts: 6
Serial and BigSerial maxvalues

When I define a serial or bigserial field type, a sequence is created. In any case, the maxvalue equals 9223372036854775807 which corresponds to a bigint value. Why?

Respectfully,
Jorge Maldonado
Reply With Quote
  #2 (permalink)  
Old 09-28-11, 18:16
shammat shammat is offline
Registered User
 
Join Date: Nov 2003
Posts: 2,408
Probably because sequences are based on bigint, so there is no way to create a sequence that returns integers.

Quote:
Originally Posted by Postgres manual
Sequences are based on bigint arithmetic, so the range cannot exceed the range of an eight-byte integer
Taken from: http://www.postgresql.org/docs/curre...esequence.html

If you are concerned about this, then use a bigserial type.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On