List:General Discussion« Previous MessageNext Message »
From:Paul DuBois Date:December 11 1999 5:29pm
Subject:Re: Auto_Increment rollover
View as plain text  
At 9:16 AM -0800 1999-12-11, J C Lawrence wrote:
>Given an auto_increment column, can I trust it to do the right thing
>and roll back to 0 when the max value of the typ is exceeded?  What
>happens if 0 is occupied?  Does it then find the next available free

No.  You should use a type that is large enough to hold the largest
value you expect to have.  If the sequence reaches the largest value,
the next attempt to generate a sequence value results in an error.

>Consider the case of an auto_increment unsigned bigint.  What
>happens if the last value assigned was 0xFFFFFFFFFFFFFFFF and you
>add a new row?  What value does it get?  What if there is a row with
>value 0, and value N (say 5) is unassigned?

You cannot have a row with value 0 in an auto-increment column.
Assigning 0 is like assigning NULL - MySQL generates a sequence number
and assigns that instead.

Paul DuBois, paul@stripped
Auto_Increment rolloverJ C Lawrence11 Dec
  • Re: Auto_Increment rolloverPaul DuBois11 Dec
  • Re: Auto_Increment rolloverJoshua Chamas12 Dec
Re: Auto_Increment rolloverJ C Lawrence11 Dec
  • Re: Auto_Increment rolloverPaul DuBois12 Dec
Re: Auto_Increment rolloverJ C Lawrence12 Dec