Bug #76648 Wrong query when update row in table
Submitted: 10 Apr 2015 7:54 Modified: 16 Apr 2015 14:07
Reporter: mon pia Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL for Windows: MySQL for Excel Severity:S3 (Non-critical)
Version:1.3.3 OS:Microsoft Windows (7)
Assigned to: CPU Architecture:Any
Tags: UPDATE

[10 Apr 2015 7:54] mon pia
Description:
When I want to update some row in my table and then commit changes I get such warning:
====================================
Edited data for Table Films was committed to MySQL with warnings. Press OK to continue.

Deleted 0, Inserted 0, Updated 0 row(s) with the following SQL statement(s):

UPDATE `My_database`.`Films` 
SET `Title`='abc abc' 
WHERE `Id`=3 AND (('abc abc lll lll' IS NULL AND `Title` IS NULL) OR `Title`='abc abc lll lll') 
AND (('http://www...' IS NULL AND `Link` IS NULL) OR `Link`='http://www...') 
AND (('2.0' IS NULL AND `DCVersion` IS NULL) OR `DCVersion`='2.0') 
AND (('http://img...' IS NULL AND `ImageLink` IS NULL) OR `ImageLink`='http://img...') 
AND ((null IS NULL AND `Description` IS NULL) OR `Description`=null) 
AND `AddDate`=null

The server returned 1 warning(s):
001: Query did not match any rows in the DB, values in the row 4 may have changed; please refresh values from the DB.

====================================

But when I want to select such row (with these conditionals in WHERE clause), it says, that there is no such rows.
So I started checking what is wrong and I saw, that when we use "`AddDate`=null" it doesn't work - there should be 'IS NULL'. 
In my database some columns can have null values, so I think that this warning is a bug, because something like this shouldn't happen.

How to repeat:
Maybe when the last two columns has null values.

Suggested fix:
Last check in WHERE clause should also have checking is it null like this:
AND ((null IS NULL AND `AddDate` IS NULL) OR `AddDate`=null)
[16 Apr 2015 14:07] Miguel Solorzano
We're sorry, but the bug system is not the appropriate forum for asking help on using MySQL products. Your problem is not the result of a bug.

Support on using our products is available both free in our forums at http://forums.mysql.com/ and for a reasonable fee direct from our skilled support engineers at http://www.mysql.com/support/

Thank you for your interest in MySQL.

https://dev.mysql.com/doc/refman/5.6/en/problems-with-null.html