List:General Discussion« Previous MessageNext Message »
From:Michael Widenius Date:September 22 1999 3:03pm
Subject:Re: BUG ? Auto_increment and tiny_int
View as plain text  
>>>>> "Rick" == Rick Moore <lrmoore@stripped> writes:

Rick> It does not wrap to 0-- I had the same misconception.
Rick> create table test2 (
Rick> id tinyint unsigned not null auto_increment );

Rick> insert into test2( id ) values( 253 );

Rick> insert into test2( id ) values (NULL);
Rick> insert into test2( id ) values (NULL);
Rick> insert into test2( id ) values (NULL);
Rick> Error 1062: Duplicate key entry '255' for key 1.

Yes;  MyISAM does not wrap but stops at the last possible key value.

Rick> Another interesting thing:

Rick> show columns from test2;

Rick> +-------+---------------------+------+-----+---------+----------------+-----
Rick> ----
Rick> ------------------------+
Rick> | Field | Type                | Null | Key | Default | Extra          |
Rick> Privileg
Rick> es                      |
Rick> +-------+---------------------+------+-----+---------+----------------+-----
Rick> ----
Rick> ------------------------+
Rick> | id    | tinyint(3) unsigned |      | PRI | NULL    | auto_increment |
Rick> select,i
Rick> nsert,update,references |
Rick> +-------+---------------------+------+-----+---------+----------------+-----
Rick> ----
Rick> ------------------------+
Rick> 1 row in set (0.00 sec)

Rick> I thought I specified "not null?"  I haven't researched the manual
Rick> thoroughly, but I assume this is an intentional silent column change...

The above 'Default' is ok as NULL for an auto_increment value means
'next value'.

Regards,
Monty
Thread
BUG ? Auto_increment and tiny_intPeter Zaitsev21 Sep
  • Re: BUG ? Auto_increment and tiny_intScott Hess21 Sep
    • Re: BUG ? Auto_increment and tiny_intMichael Widenius22 Sep
  • Re: BUG ? Auto_increment and tiny_intRick Moore22 Sep
    • Re: BUG ? Auto_increment and tiny_intMartin Ramsch22 Sep
      • Re: BUG ? Auto_increment and tiny_intPaul DuBois22 Sep
    • Re: BUG ? Auto_increment and tiny_intMichael Widenius22 Sep