List:Bugs« Previous MessageNext Message »
From:jason king Date:April 30 2000 3:22pm
Subject:RE: AUTO_INCREMENT bug after inserting negative value
View as plain text  
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Michael Widenius writes ..

>The problem is that MySQL only supports unsigned values for
>auto_increment-fields;  This is true even if you define the
>auto_increment field as a signed value.  (This is basicly sound as it
>will ensure that MySQL can use the full potential range for a number
>as autoincrement values).
>
>Inserting -1 is basicly the same as inserting the max value for the
>field. As MySQL can't give you a higher value for the next value it
>will insert the max possible value for the column in the table.

hmm .. now I'm confused .. negative auto_increment values work in my
Windows version

  mysql  Ver 9.38 Distrib 3.22.32, for Win95/Win98 (i586)

  Windows NT Version 4.0 Server Service Pack 6a

mysql> create table blah ( id INTEGER NOT NULL AUTO_INCREMENT PRIMARY
KEY );
Query OK, 0 rows affected (0.03 sec)

mysql> insert blah values (-1);
Query OK, 1 row affected (0.00 sec)

mysql> insert blah values (null);
Query OK, 1 row affected (0.00 sec)

mysql> select * from blah;
+----+
| id |
+----+
| -1 |
|  0 |
+----+
2 rows in set (0.01 sec)

- -- 
  jason - elephant@stripped -

-----BEGIN PGP SIGNATURE-----
Version: PGPfreeware 6.5.1 for non-commercial use <http://www.pgp.com>

iQA/AwUBOQzcWzYpBpopJvWUEQJhpACcC2QzkIIuzNoGO0qAUHhFkCBaE/QAoJk8
42j0hudMi014SgDRuV8EFJhq
=CF9X
-----END PGP SIGNATURE-----

Thread
AUTO_INCREMENT bug after inserting negative valueManuel Lemos30 Apr
  • Re: AUTO_INCREMENT bug after inserting negative valuesinisa30 Apr
  • AUTO_INCREMENT bug after inserting negative valueMichael Widenius30 Apr
    • RE: AUTO_INCREMENT bug after inserting negative valuejason king30 Apr
      • Re: AUTO_INCREMENT bug after inserting negative valueThimble Smith1 May
      • RE: AUTO_INCREMENT bug after inserting negative valueMichael Widenius1 May
    • Re: AUTO_INCREMENT bug after inserting negative valueManuel Lemos30 Apr
      • Re: AUTO_INCREMENT bug after inserting negative valueMichael Widenius1 May
        • Re: AUTO_INCREMENT bug after inserting negative valueManuel Lemos10 May
          • Re: AUTO_INCREMENT bug after inserting negative valueMichael Widenius10 May
            • Re: AUTO_INCREMENT bug after inserting negative valueManuel Lemos5 Jun