Bug #18424 auto_increment fails with a float(10,0) field
Submitted: 22 Mar 2006 15:22 Modified: 3 Aug 2006 8:06
Reporter: Ramón Email Updates:
Status: Can't repeat Impact on me:
None 
Category:MySQL Server Severity:S1 (Critical)
Version:5.0.19 OS:Linux (Linux 2.6.15 debian)
Assigned to: Sveta Smirnova CPU Architecture:Any

[22 Mar 2006 15:22] Ramón
Description:
When upgrading from 5.0.18 to 5.0.19, mysql fails when trying to insert a new row on a table. Primary key is a float(10,0) auto_increment field.

(Table is checked and verified)

When I have changed the field to integer type, then it ran perfectly.

How to repeat:
Create this table and insert several rows.

CREATE TABLE sessions (
   ses_id float(10,0) NOT NULL auto_increment,
   ses_user_fk varchar(10),
   ses_date datetime DEFAULT '0000-00-00 00:00:00' NOT NULL,
   ses_address varchar(50),
   ses_enabled enum('0','1') DEFAULT '0' NOT NULL,
   ses_datelast datetime DEFAULT '0000-00-00 00:00:00' NOT NULL,
   PRIMARY KEY (ses_id),
   UNIQUE ses_id (ses_id)
);
[23 Mar 2006 9:09] Hartmut Holzgraefe
Can't reproduce, tried both a fresh 5.0.19 installation and starting on 5.0.18 then upgrading to 5.0.19 midgame, but all worked out as expected

Can you give a more detailed description how to reproduce this?
[23 Mar 2006 9:17] Ramón
Hi,

I reproduced with a new database:

# mysql
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 12 to server version: 5.0.19-Debian_2-log

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> create database test1;
Query OK, 1 row affected (0.20 sec)

mysql> use test1;
Database changed
mysql> CREATE TABLE sessions ( ses_id float(10,0) NOT NULL auto_increment, ses_user_fk varchar(10), ses_date datetime DEFAULT '0000-00-00 00:00:00' NOT NULL, ses_address varchar(50), ses_enabled enum('0','1') DEFAULT '0' NOT NULL, ses_datelast datetime DEFAULT '0000-00-00 00:00:00' NOT NULL, PRIMARY KEY (ses_id) );
Query OK, 0 rows affected (0.18 sec)

mysql> insert into sessions set ses_user_fk='1';
Query OK, 1 row affected (0.45 sec)

mysql> insert into sessions set ses_user_fk='2';
ERROR 1062 (23000): Duplicate entry '1' for key 1
mysql> insert into sessions set ses_user_fk='3';
ERROR 1062 (23000): Duplicate entry '1' for key 1
mysql>  

Regards,

	Ramón.
[23 Mar 2006 15:53] Hartmut Holzgraefe
can't reproduce this on SuSE 9.3, probably a debian specific problem. are you using the debian mysql packages ore one the binaries provided by us on dev.mysql.com?
[24 Mar 2006 9:08] Ramón
Hi,

binaries are from DEBIAN.

Kind regards.

 Descripción: mysql database common files (e.g. /etc/mysql/my.cnf)
    MySQL is a fast, stable and true multi-user, multi-threaded SQL database server. SQL (Structured Query Language) is the
    most popular database query language in the world. The main goals of MySQL are speed, robustness and ease of use.

    This package includes files needed by all versions of the client library.

  Marcas: role::content:data, special::auto-inst-parts, works-with::db:sql
  Prioridad: opcional
  Sección: misc
  Desarrollador: Christian Hammers <ch@debian.org>
  Tamaño comprimido: 37,0k
  Tamaño sin comprimir: 90,1k
  Paquete fuente: mysql-dfsg-5.0
  --\ Entra en conflicto
    --- mysql-common-4.1
  --\ Reemplaza
    --- mysql-common-4.1
  --- Nombres del paquete proporcionados por mysql-common
  --- Paquetes que dependen de mysql-common
  --\ Versiones
p    4.0.24-10sarge1
p    mysql-common-4.1 4.1.11a-4sarge2
p    5.0.18-9
i    5.0.19-2
[3 Aug 2006 8:06] Sveta Smirnova
I can not repeat it on Debian using our binaries accessible from http://dev.mysql.com/downloads/mysql/5.0.html