Bug #5510 inserting Null in AutoIncrement primary key Column Fails
| Submitted: | 10 Sep 2004 4:10 | Modified: | 17 Sep 2004 21:24 |
|---|---|---|---|
| Reporter: | Jorge del Conde | Email Updates: | |
| Status: | Closed | Impact on me: | |
| Category: | MySQL Server | Severity: | S2 (Serious) |
| Version: | 4.1.4 | OS: | Any (All) |
| Assigned to: | Konstantin Osipov | CPU Architecture: | Any |
[10 Sep 2004 4:10]
Jorge del Conde
[10 Sep 2004 23:01]
Jorge del Conde
I forgot to mention this in my first comment: Please note that this is also broken in a very similar way (same bug?)- CREATE TABLE `nsdevices` ( `DEVICEID` bigint(20) NOT NULL auto_increment, `NICKNAME` varchar(64) default NULL, `SYSOBJECTID` varchar(64) default NULL, `SYSDESCRIPTOR` varchar(255) default NULL, `STATUS` int(11) default NULL, `FIRMWARE` varchar(32) default NULL, `IP` varchar(32) default NULL, `BOOTPROM` varchar(80) default NULL, `SYSLOCATION` varchar(255) default NULL, `SYSNAME` varchar(255) default NULL, `SYSCONTACT` varchar(255) default NULL, `BASEMAC` varchar(32) default NULL, `CHASSISID` varchar(32) default NULL, `TIMELASTUPDATED` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, `MONITORTYPE` int(11) default NULL, `POLLGROUP` int(11) default NULL, PRIMARY KEY (`DEVICEID`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; If you pass a NULL to the TIMELASTUPDATED column, you get the same sort of "Can not be Null" exception as you do in the primary key insert. Your bug might be a general error, when NOT NULL and default are specified, then you can not pass a null on the insert.
[11 Sep 2004 2:16]
Mark Matthews
Server bug: mysql> set @a=null; Query OK, 0 rows affected (0.02 sec) mysql> prepare stmt1 from 'insert into nsdevices (DEVICEID) VALUES (?)'; Query OK, 0 rows affected (0.00 sec) Statement prepared mysql> execute stmt1 using @a; ERROR 1048 (23000): Column 'DEVICEID' cannot be null mysql>
[15 Sep 2004 18:32]
Sergei Golubchik
same for timestamps
[17 Sep 2004 14:22]
Konstantin Osipov
bk commit - 4.1 tree (konstantin:1.2018) BUG#5510
[17 Sep 2004 21:11]
Konstantin Osipov
Fixed in 4.1.6
Portions of this website are copyright © 2001, 2002 The PHP Group
Page generated in 0.056 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.