Bug #114587 | i am able to insert the value in table , while my column is set on not null. | ||
---|---|---|---|
Submitted: | 8 Apr 2024 19:06 | Modified: | 9 Apr 2024 20:09 |
Reporter: | Sunny kumar | Email Updates: | |
Status: | Not a Bug | Impact on me: | |
Category: | MySQL Server: DML | Severity: | S1 (Critical) |
Version: | 8.0.36 | OS: | Windows (Microsoft Windows 10 Enterprise) |
Assigned to: | CPU Architecture: | Any | |
Tags: | WBBugReporter |
[8 Apr 2024 19:06]
Sunny kumar
[9 Apr 2024 10:16]
MySQL Verification Team
Hi Mr. kumar, Thank you for your bug report. However, this is not a bug. These is the result that we get: select * from uniq; +----+------+---------+--------+------+ | id | name | address | state | age | +----+------+---------+--------+------+ | 6 | p | | mumbai | 17 | +----+------+---------+--------+------+ Problem is that you have set `address` column as NOT NULL. However, you have not inserted NULL in it, but a blank. A blank string is a very valid string. If you have tried to insert NULL, you would have got this : insert into uniq values(6,"p",NULL,"mumbai",17); ERROR 1048 (23000): Column 'address' cannot be null Not a bug.
[9 Apr 2024 20:09]
Sunny kumar
Hi, SELECT CHAR_LENGTH(address) AS address_length FROM uniq; when you'll run rhis query you can get the size of address , which is ZERO. which means here value is NULL. so this instertion should not possible, cause i am giving null value which should not be acceptable. so this is BUG(functionality should not be affect any how). Thanks Sunny Kumar
[10 Apr 2024 10:21]
MySQL Verification Team
Hi Mr. kumar, For your information, the empty string has a size of 0 (zero). This is SQL, not a C programming language, so '\0' is not counted at all. Not a bug.