[MDEV-28140] Unexpected error when UPDATE a NULL Created: 2022-03-21  Updated: 2023-04-27

Status: Confirmed
Project: MariaDB Server
Component/s: Data Manipulation - Update
Affects Version/s: 10.7.3
Fix Version/s: 10.4, 10.5, 10.6

Type: Bug Priority: Major
Reporter: John Jove Assignee: Oleksandr Byelkin
Resolution: Unresolved Votes: 0
Labels: innodb
Environment:

OS: Ubuntu-20.04 LTS


Issue Links:
Blocks
is blocked by MDEV-19362 New STRICT flags for sql_mode Open
Relates
relates to MDEV-27480 Functions don't validate arguments pr... Stalled
relates to MDEV-28069 A misleading warning message from the... Open

 Description   

/* init */ CREATE TABLE t(c1 BLOB NOT NULL, c2 TEXT);
/* init */ INSERT IGNORE INTO t VALUES (NULL, NULL), (NULL, 'abc');
 
mariadb> UPDATE t SET c2 = 'test' WHERE c1;
ERROR 1292 (22007): Truncated incorrect DOUBLE value: ''
 
mariadb> SELECT * FROM t WHERE c1;
Empty set, 2 warnings (0.00 sec)
 
mariadb> DELETE FROM t WHERE c1;
Query OK, 0 rows affected, 2 warnings (0.00 sec)

Only UPDATE statement reports an error, while SELECT and DELETE do not report the error.



 Comments   
Comment by Sergei Golubchik [ 2022-03-23 ]

yes, the warning/error should happen in DELETE as well

Comment by John Jove [ 2022-03-24 ]

I agree with your reply. UPDATE and DELETE should have the same impact.
By the way, I reproduced this case in MySQL, but the result is different from MariaDB. Please see:

mysql> UPDATE t SET c2 = 'test' WHERE c1;
Query OK, 0 rows affected (0.00 sec)
Rows matched: 0  Changed: 0  Warnings: 0
 
mysql> SELECT * FROM t WHERE c1;
Empty set (0.00 sec)
 
mysql> DELETE FROM t WHERE c1;
Query OK, 0 rows affected (0.00 sec)

In MySQL, the warning and error do not happen in any statements, which simply do not affect any data.

Generated at Thu Feb 08 09:58:23 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.