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 > MySQL > Auto increment field hit maximum integer value

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 01-12-06, 05:12
Eng Goh Eng Goh is offline
Registered User
 
Join Date: Nov 2005
Posts: 9
Auto increment field hit maximum integer value

What happens when MySQL auto increment field hit the maximum integer value that the data type can contain/handle ?

My search around the net yield the following :

"The behavior of the auto-increment mechanism is not defined … if the value becomes bigger than the maximum integer that can be stored in the specified integer type."
http://dev.mysql.com/doc/refman/5.0/...nt-column.html

"The behaviour of auto-increment is not defined … if the value becomes bigger than the maximum integer that can be stored in the specified integer type."
http://sunsite.mff.cuni.cz/MIRRORS/f...nt_column.html (documents MySQL up to Version 4.1.0-alpha)

If there is no proper defined elegant behaviour when auto increment hits max. I think it will be hard for anyone to make use of it as it is not reliable.

Can anyone give me a definite answer or point me to a definite answer ?

Thanks.
Reply With Quote
  #2 (permalink)  
Old 01-12-06, 05:40
anjanesh anjanesh is offline
Registered User
 
Join Date: Feb 2005
Location: Mumbai, India
Posts: 161
PHP Code:
CREATE TABLE `test` (
  `
idint(11NOT NULL auto_increment,
  `
datavarchar(100NOT NULL default '',
  
PRIMARY KEY  (`id`)
TYPE=MyISAM PACK_KEYS=0 AUTO_INCREMENT=;

ALTER TABLE `testPACK_KEYS=0 CHECKSUM=0 DELAY_KEY_WRITE=0 AUTO_INCREMENT=2147483647
INSERT INTO 
`testVALUES('''data1'); // Works
INSERT INTO `testVALUES('''data2'); // At this point I get an error : 
Code:
#1062 - Duplicate entry '2147483647' for key 1
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