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

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.048 sec. using MySQL 8.4.7-u6-cloud

Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.