Bug #111266 | Can't delete a row | ||
---|---|---|---|
Submitted: | 3 Jun 2023 5:30 | Modified: | 5 Jun 2023 9:25 |
Reporter: | Doris Li | Email Updates: | |
Status: | Not a Bug | Impact on me: | |
Category: | MySQL Server | Severity: | S1 (Critical) |
Version: | 8.0.33 | OS: | Ubuntu (20.04.2) |
Assigned to: | CPU Architecture: | x86 (x86_64) |
[3 Jun 2023 5:30]
Doris Li
[3 Jun 2023 12:06]
Frederic Descamps
not sure the `= NULL` is valid. Try with: delete from data_a_tmp where a4 is NULL;
[3 Jun 2023 13:56]
Frederic Descamps
In SQL, a comparison between a null value and any other value (including another null) using a comparison operator (eg =, !=, <, etc) will result in a null, which is considered as false. The reasoning is that a null means "unknown", the result of any comparison to a null is also "unknown". So you'll get no hit on rows by coding where my_column = null. The correct syntax for testing if a column is null, via IS null and IS NOT null.
[3 Jun 2023 13:56]
Frederic Descamps
See the manual: https://dev.mysql.com/doc/refman/8.0/en/working-with-null.html
[5 Jun 2023 9:25]
Doris Li
I finally figured out that it is not a bug.