11 messages in com.mysql.lists.bugsAUTO_INCREMENT bug after inserting ne...
FromSent OnAttachments
Manuel Lemos29 Apr 2000 16:17 
sin...@mysql.com30 Apr 2000 05:24 
Michael Widenius30 Apr 2000 05:39 
jason king30 Apr 2000 08:22 
Manuel Lemos30 Apr 2000 11:08 
Thimble Smith30 Apr 2000 13:00 
Michael Widenius01 May 2000 02:12 
Michael Widenius01 May 2000 02:22 
Manuel Lemos09 May 2000 16:34 
Michael Widenius10 May 2000 04:32 
Manuel Lemos04 Jun 2000 21:52 
Subject:AUTO_INCREMENT bug after inserting negative value
From:Manuel Lemos (mle@acm.org)
Date:04/29/2000 04:17:04 PM
List:com.mysql.lists.bugs

Hello,

Please acknowledge this bug report and let me know when you have analized/fixed it. BTW, is there a bug tracking application for MySQL development like PHP development has?

Description:

If you insert a negative integer number (say -1) in signed AUTO_INCREMENT field and then insert a NULL to make it return the next value (0) as the last inserted id, it will return a very large unsigned integerinstead (4294967296).

This bug was detected with Metabase driver test suite. Metabase is a database abstraction package for PHP. See this page for more information:

http://phpclasses.UpperDesign.com/browse.html/package/20

Metabase uses auto-incremented fields to emulates sequences that MySQL does not support. To create a sequence with a given starting number, a table is created with only one integer AUTO_INCREMENT field. To make the initial sequence number be one, Metabase MySQL driver inserts the value -1 in the table.

The bug shows in the tested version (3.23.6 alpha on Linux) but it didn't show on version "mysql Ver 9.16 Distrib 3.21.31, for sun-solaris2.6 (sparc)".

How-To-Repeat:

CREATE TABLE test (sequence INT DEFAULT 0 NOT NULL AUTO_INCREMENT, PRIMARY KEY
(sequence)); INSERT INTO test (sequence) VALUES (-1); INSERT INTO test (sequence) VALUES (NULL); SELECT LAST_INSERT_ID(); SELECT * FROM test;

Submitter-Id: mle@acm.org Originator: Manuel Lemos Organization: MySQL support: none Synopsis: AUTO_INCREMENT bug after inserting negative value Severity: non-critical Priority: low Category: mysql Class: sw-bug Release: mysql-3.23.6-alpha (Official MySQL RPM) Server: /usr/bin/mysqladmin Ver 7.12 Distrib 3.23.6-alpha, for pc-linux-gnu on
i686

TCX Datakonsult AB, by Monty

Server version 3.23.6-alpha-log Protocol version 10 Connection Localhost via UNIX socket UNIX socket /var/lib/mysql/mysql.sock Uptime: 5 hours 17 min 16 sec

Threads: 1 Questions: 2182 Slow queries: 0 Opens: 311 Flush tables: 1 Open
tables: 4

Environment:

System: Linux cohones.serio.org 2.2.5-23cl #1 sex jul 2 00:31:56 EST 1999 i586
unknown Architecture: i586

Some paths: /usr/bin/perl /usr/bin/make /usr/bin/gmake /usr/bin/gcc /usr/bin/cc GCC: Reading specs from /usr/lib/gcc-lib/i386-conectiva-linux/egcs-2.91.66/specs gcc version egcs-2.91.66 19990314/Linux (egcs-1.1.2 release) Compilation info: CC='egcs' CFLAGS='-O6 -fomit-frame-pointer -mpentium'
CXX='egcs' CXXFLAGS='-O6 -fomit-frame-pointer -felide-constructors
-fno-exceptions -fno-rtti -mpentium' LDFLAGS='' LIBC: lrwxrwxrwx 1 root root 13 Nov 25 18:57 /lib/libc.so.6 ->
libc-2.1.1.so -rwxr-xr-x 1 root root 4016875 Jul 1 1999 /lib/libc-2.1.1.so -rw-r--r-- 1 root root 19561856 Jul 1 1999 /usr/lib/libc.a -rw-r--r-- 1 root root 178 Jul 1 1999 /usr/lib/libc.so Configure command: ./configure --disable-shared
--with-mysqld-ldflags=-all-static --with-client-ldflags=-all-static
--enable-assembler --with-mysqld-user=mysql
--with-unix-socket-path=/var/lib/mysql/mysql.sock --prefix=/ --exec-prefix=/usr
--libexecdir=/usr/sbin --sysconfdir=/etc --datadir=/usr/share
--localstatedir=/var/lib/mysql --infodir=/usr/info --includedir=/usr/include
--mandir=/usr/man '--with-comment=Official MySQL RPM' Perl: This is perl, version 5.005_03 built for i386-linux