List:General Discussion« Previous MessageNext Message »
From:sasha Date:March 3 2000 7:02pm
Subject:Re: is there any way to AUTO_INCREMENT fields with non-zero DEFAULTs?
View as plain text  
> 
> 2) I'm wondering if any field with an auto_increment should be
>    automatically declared as an unsigned field?  Trying to use negative
>    numbers causes an error to occur:
> 
>    CREATE TEMPORARY TABLE foo (
>         ikey SMALLINT AUTO_INCREMENT PRIMARY KEY,
>         name CHAR(30)
>    ) AUTO_INCREMENT=-30
>    ;
>    INSERT INTO foo VALUES (NULL, "Nem");
>    INSERT INTO foo VALUES (NULL, "Monty");
> 
>    You'll get:
>      ERROR 1062 at line 8: Duplicate entry '32767' for key 1
> 
>    So, either this is a bug and should be fixed (since 32767 != -30 and
>    trying to insert another value causes an error), or the field should
>    automatically be declared UNSIGNED and the above would generate a error
>    when the table is CREATE()d (since -30 is signed).
> 
> Anybody have any thoughts or ideas??

That is a bug, and I was able to verify it. We will fix it as soon as possible.

Sasha Pachev

+------------------------------------------------------------------+
| TcX  ____  __     _____   _____  ___     ==  mysql@stripped        |
|     /*/\*\/\*\   /*/ \*\ /*/ \*\ |*|     Sasha Pachev            |
|    /*/ /*/ /*/   \*\_   |*|   |*||*|     mailto:sasha@stripped  |
|   /*/ /*/ /*/\*\/*/  \*\|*|   |*||*|     Provo, Utah, USA        |
|  /*/     /*/  /*/\*\_/*/ \*\_/*/ |*|____                         |
|  ^^^^^^^^^^^^/*/^^^^^^^^^^^\*\^^^^^^^^^^^                        |
|             /*/             \*\ Developers Team                  |
+------------------------------------------------------------------+
Thread
is there any way to AUTO_INCREMENT fields with non-zero DEFAULTs?Skip Montanaro1 Mar
  • RE: is there any way to AUTO_INCREMENT fields with non-zero DEFAULTs?Josh Hartmann1 Mar
    • Re: is there any way to AUTO_INCREMENT fields with non-zero DEFAULTs?Thimble Smith1 Mar
      • Re: is there any way to AUTO_INCREMENT fields with non-zero DEFAULTs?Nem W Schlecht2 Mar
        • Re: is there any way to AUTO_INCREMENT fields with non-zero DEFAULTs?Thimble Smith2 Mar
          • Re: is there any way to AUTO_INCREMENT fields with non-zero DEFAULTs?Nem W Schlecht2 Mar
        • Re: is there any way to AUTO_INCREMENT fields with non-zero DEFAULTs?sasha3 Mar
  • Re: is there any way to AUTO_INCREMENT fields with non-zeroDEFAULTs?Ralph Graulich1 Mar