Bug #70684 | HAVING referring to subquery results in WARNING 1292 | ||
---|---|---|---|
Submitted: | 22 Oct 2013 8:13 | Modified: | 22 Oct 2013 11:33 |
Reporter: | Valeriy Kravchuk | Email Updates: | |
Status: | Verified | Impact on me: | |
Category: | MySQL Server: Optimizer | Severity: | S3 (Non-critical) |
Version: | 5.5.33, 5.6.14 | OS: | Any |
Assigned to: | CPU Architecture: | Any | |
Tags: | having, regression, subquery |
[22 Oct 2013 8:13]
Valeriy Kravchuk
[22 Oct 2013 11:33]
MySQL Verification Team
Thank you for the bug report. 5.0 affected too.
[24 Oct 2013 12:20]
MySQL Verification Team
Tested on 5.1: C:\dbs>c:\dbs\5.1\bin\mysql -uroot --port=3510 --prompt="mysql 5.1 > " Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 1 Server version: 5.1.73-Win X64 Source distribution Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql 5.1 > CREATE DATABASE DX; Query OK, 1 row affected (0.01 sec) mysql 5.1 > USE DX Database changed mysql 5.1 > CREATE TABLE `test` ( -> `id` int(11) NOT NULL AUTO_INCREMENT, -> `data` varchar(20) DEFAULT NULL, -> KEY `id` (`id`) -> ) ENGINE=InnoDB; Query OK, 0 rows affected (0.08 sec) mysql 5.1 > mysql 5.1 > insert into test (data) values ('Some data'), (NULL); Query OK, 2 rows affected (0.03 sec) Records: 2 Duplicates: 0 Warnings: 0 mysql 5.1 > mysql 5.1 > SELECT data, (IF(ISNULL(data) , (SELECT "FOO"), "BAR")) as synth_data FROM test HAVING (synth_data IS NOT NULL); +-----------+------------+ | data | synth_data | +-----------+------------+ | Some data | BAR | | NULL | FOO | +-----------+------------+ 2 rows in set, 2 warnings (0.00 sec) mysql 5.1 > show warnings\G *************************** 1. row *************************** Level: Warning Code: 1292 Message: Truncated incorrect INTEGER value: 'BAR' *************************** 2. row *************************** Level: Warning Code: 1292 Message: Truncated incorrect INTEGER value: 'FOO' 2 rows in set (0.00 sec) mysql 5.1 > SELECT data, (IF(ISNULL(data) , (SELECT "FOO"), "BAR")) as synth_data FROM test HAVING (convert(synth_data, char) IS NOT NULL); +-----------+------------+ | data | synth_data | +-----------+------------+ | Some data | BAR | | NULL | FOO | +-----------+------------+ 2 rows in set (0.00 sec) mysql 5.1 >