Bug #47685 no AUTOINCREMENT option for DECIMAL
Submitted: 28 Sep 2009 18:14 Modified: 28 Sep 2009 18:45
Reporter: Peter Laursen (Basic Quality Contributor) Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: Data Types Severity:S4 (Feature request)
Version:5.0+ OS:Any
Assigned to: CPU Architecture:Any
Tags: qc

[28 Sep 2009 18:14] Peter Laursen
Description:
You may find me pedantic (again), but I have a comment to

dev.mysql.com/doc/refman/5.0/en/create-table.html 
"AUTO_INCREMENT applies only to integer and floating-point types."

Before 5.02 (I think) a DECIMAL was a floating point type.  After that it was not.  This means that AUTOINCREMENT option for DECIMAL is broken for upgrading users.  Also other databases (at least SQL Server) has this option. So it is also a (small) problem for migrating users.  Small only because a BIGINT (or DOUBLE in some cases) will be usable in most cases as a replacement.

How to repeat:
CREATE TABLE `t1` (`id` FLOAT  AUTO_INCREMENT KEY); 
-- works

CREATE TABLE `t2` (`id` DECIMAL DECIMAL(19,2) AUTO_INCREMENT KEY);
-- fails with Error Code : 1063
-- Incorrect column specifier for column 'id'

Suggested fix:
I think AUTOINCREMENT option for DECIMAL should be (re)introduced.
[28 Sep 2009 18:45] Valeriy Kravchuk
Thank you for the feature request.