Bug #157 DEFAULT value allowed with AUTO_INCREMENT, but silently dropped
Submitted: 17 Mar 2003 1:08 Modified: 22 Mar 2003 10:03
Reporter: Indrek Siitan Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:all OS:Any (all)
Assigned to: CPU Architecture:Any

[17 Mar 2003 1:08] Indrek Siitan
Description:
MySQL allows defining a DEFAULT value to the auto_increment field, but silently drops it.

How to repeat:
mysql> create table foo (bar int default 42 auto_increment primary key) ;
Query OK, 0 rows affected (0.01 sec)

mysql> desc foo;
+-------+---------+------+-----+---------+----------------+
| Field | Type    | Null | Key | Default | Extra          |
+-------+---------+------+-----+---------+----------------+
| bar   | int(11) |      | PRI | NULL    | auto_increment |
+-------+---------+------+-----+---------+----------------+
1 row in set (0.00 sec)

Suggested fix:
A syntax error should be displayed telling that DEFAULT is not allowed when defining an auto_increment field.
[22 Mar 2003 10:03] Jani Tolonen
Fixed.
Regards,
Jani