[MDEV-28069] A misleading warning message from the DELETE statement Created: 2022-03-15  Updated: 2022-03-23

Status: Open
Project: MariaDB Server
Component/s: Data Manipulation - Delete, Server
Affects Version/s: 10.8.2
Fix Version/s: None

Type: Bug Priority: Minor
Reporter: John Jove Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None

Issue Links:
Relates
relates to MDEV-19362 New STRICT flags for sql_mode Open
relates to MDEV-28140 Unexpected error when UPDATE a NULL Confirmed
relates to MDEV-28142 Unexpected UPDATE behavior under stri... Open

 Description   

I try the following statements in MariaDB 10.8.2 with strict SQL mode.

DROP TABLE IF EXISTS t0;
CREATE TABLE t0(c0 INT);
INSERT INTO t0 VALUES (1);
DELETE FROM t0 WHERE IFNULL((-1) | (-1), 0);
SHOW WARNINGS;

The DELETE statement succeeded, but a warning message is generated as following:

mysql> SHOW WARNINGS;
+---------+------+-----------------------------------------------------------------------------+
| Level   | Code | Message                                                                     |
+---------+------+-----------------------------------------------------------------------------+
| Warning | 1916 | Got overflow when converting '18446744073709551615' to INT. Value truncated |
+---------+------+-----------------------------------------------------------------------------+
1 row in set (0.00 sec)

I think there should be no warnings. Otherwise, this truncate warning should make the DELETE statement fail in strict SQL mode. Moreover, I try the same WHERE clause in the UPDATE statement, where the UPDATE statement succeeded without warnings.

DROP TABLE IF EXISTS t0;
CREATE TABLE t0(c0 INT);
INSERT INTO t0 VALUES (1);
UPDATE t0 SET c0 = 2 WHERE IFNULL((-1) | (-1), 0);
SHOW WARNINGS;



 Comments   
Comment by Marko Mäkelä [ 2022-03-15 ]

Thank you. This is closely related to MDEV-27840.

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