Quantcast
Channel: MySQL Forums - InnoDB
Viewing all articles
Browse latest Browse all 1956

insert not null issue (1 reply)

$
0
0
Hi all;

Here is my table;

delimiter ;
CREATE TABLE `t1` (
`idt1` int(11) NOT NULL auto_increment,
`f1` varchar(45) default NULL,
`f2` varchar(45) NOT NULL,
PRIMARY KEY (`idt1`),
UNIQUE KEY `idt1_UNIQUE` (`idt1`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=latin5;

f2 column properties is "not null" and didnt have default value.

Mysql workcbench Sql development :

Test 1:

INSERT INTO t1 (f1) VALUES ('a');

Mysql give error Error Code: 1364
Field 'f2' doesn't have a default value

-------------------------------------------
Test 2:

INSERT INTO t1 (f1,f2) VALUES ('a','');

Mysql can insert null (blank) value to f2 column.

Is this is a bug ? Thanks.


Host : Windows 7 Ultimate (Developer machine)
Mysql : 5.0.89-community-nt

Viewing all articles
Browse latest Browse all 1956

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>