[MDEV-5017] No warning when using IF(string-input) in numeric context Created: 2013-09-16  Updated: 2014-06-06

Status: Open
Project: MariaDB Server
Component/s: None
Affects Version/s: 5.5.33
Fix Version/s: 5.5

Type: Bug Priority: Minor
Reporter: Alexander Barkov Assignee: Alexander Barkov
Resolution: Unresolved Votes: 0
Labels: None


 Description   

This query correctly returns a warning,
because 'xxx' is not a valid number.

mysql> select 'xxx'+1;
+---------+
| 'xxx'+1 |
+---------+
|       1 |
+---------+
1 row in set, 1 warning (0.00 sec)
 
mysql> show warnings;
+---------+------+-----------------------------------------+
| Level   | Code | Message                                 |
+---------+------+-----------------------------------------+
| Warning | 1292 | Truncated incorrect DOUBLE value: 'xxx' |
+---------+------+-----------------------------------------+
1 row in set (0.00 sec)

This query does not produce a warning, which is wrong:

mysql> select IF(1=1,'xxx','yyy')+1;
+-----------------------+
| IF(1=1,'xxx','yyy')+1 |
+-----------------------+
|                     1 |
+-----------------------+
1 row in set (0.00 sec)


Generated at Thu Feb 08 07:01:01 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.