Bug #106571 Incorrect warning thrown from UPDATE statement
Submitted: 25 Feb 2022 9:25 Modified: 2 Mar 2022 10:00
Reporter: John Jove Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server: DML Severity:S2 (Serious)
Version:8.0.28 OS:Ubuntu (20.04)
Assigned to: MySQL Verification Team CPU Architecture:x86

[25 Feb 2022 9:25] John Jove
Description:
I run the following statements, where the warning messages displayed in SHOW WARNINGS is incorrect, as follows:

+---------+------+-------------------------------------------------------+
| Level   | Code | Message                                               |
+---------+------+-------------------------------------------------------+
| Warning | 1366 | Incorrect decimal value: 'a' for column 'c0' at row 1 |
| Error   | 1292 | Truncated incorrect DOUBLE value: 'a'                 |
+---------+------+-------------------------------------------------------+
2 rows in set (0.00 sec)

I think the first warning message is totally wrong, because in column c0 there is no such value as 'a'.

How to repeat:
DROP TABLE IF EXISTS t0;
CREATE TABLE t0(c0 DECIMAL PRIMARY KEY, c1 FLOAT);
INSERT INTO t0 VALUES(0,1);
UPDATE t0 SET c0 = 1 WHERE (t0.c0) BETWEEN ('a') AND (t0.c1);
SHOW WARNINGS;
[25 Feb 2022 14:48] MySQL Verification Team
Hi Mr. Jove,

Thank you for your bug report.

However, this is not a bug.

No, there is no value 'a' in your table, but it is right there in your UPDATE statement.

Not a bug.
[2 Mar 2022 10:00] John Jove
I try the same where clause in the following statements:

DROP TABLE IF EXISTS t0; 
CREATE TABLE t0 (c0 DECIMAL PRIMARY KEY, c1 FLOAT); 
INSERT INTO t0 VALUES (0,1);
SELECT * FROM t0 WHERE (t0.c0) BETWEEN ('a') AND (t0.c1);
SHOW WARNINGS;

There is only one warning returned.
Does the SELECT evaluate this expression differently from the UPDATE?