Bug #28344 not null field but can insert null value
Submitted: 10 May 2007 3:24 Modified: 11 May 2007 12:23
Reporter: Yoon Jay Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server: Data Types Severity:S3 (Non-critical)
Version:5.0 OS:Linux (redhat 3.0)
Assigned to: CPU Architecture:Any
Tags: not null field

[10 May 2007 3:24] Yoon Jay
Description:
Hi.

why dose the same qeury statment return a different result?

case 1. 
OS : ms window
CREATE TABLE test` (
  `No` INTEGER UNSIGNED NOT NULL DEFAULT 0,
  `str` VARCHAR(45) NOT NULL,
  PRIMARY KEY (`No`)
)
ENGINE = MyISAM;

query statment :
insert into test set no = 0

result :
return error ( field 'str' doesn't have a default value )

it's right.

case 2. 
OS : linux redhat 3.0
create same table and same field
input same query statment

result :
Query OK, 1 row affected (0.00 sec)

i can't understand this result. i think this is wrong.

How to repeat:
.

Suggested fix:
i don't know :-(
[10 May 2007 6:04] Valeriy Kravchuk
Thank you for a problem report. Please, send the results of:

SHOW VARIABLES LIKE 'sql_mode';

from both Windows and Linux servers. Maybe, you'll discover some difference.
[11 May 2007 2:06] Yoon Jay
thanks for your answer.

i get different result from query in your msg.

ms window : 
STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION

linux :
empty

i have installed mysql 5.0 default version. why this variable 'sql_mode' have defferent values? it's very hard to me. and...i think.. my problem dose not connect with 'STRICT_TRANS_TABLES' sql_mode. what do you think?

thanks so much for your answer. and help me please.
[11 May 2007 2:26] Yoon Jay
thanks for your answer.
i solved my null value problem. i have change sql_mode value to 'STRICT_TRANS_TABLES'.

thanks~ have a good day~
[11 May 2007 2:29] Yoon Jay
thanks for your answer.
i solved my null value problem. i have change sql_mode value to 'STRICT_TRANS_TABLES' and have good reault. thank you.
It learned the many thing in your advice.
have a good day~
[11 May 2007 12:23] Valeriy Kravchuk
Closed as not a result of a bug in MySQL.