Bug #81673 UNION ALL returned incorrect result
Submitted: 1 Jun 2016 11:12 Modified: 1 Jun 2016 11:27
Reporter: Su Dylan Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: DML Severity:S3 (Non-critical)
Version:5.7.8 OS:Any
Assigned to: CPU Architecture:Any

[1 Jun 2016 11:12] Su Dylan
Description:
Output:
===
mysql> select cast('' as signed) union all select '';
+--------------------+
| cast('' as signed) |
+--------------------+
|                    |
|                    |
+--------------------+
2 rows in set, 1 warning (0.00 sec)

mysql> select cast('' as signed) union all select 'a';
+--------------------+
| cast('' as signed) |
+--------------------+
| 0                  |
| a                  |
+--------------------+
2 rows in set, 1 warning (0.00 sec)

mysql> select version();
+--------------+
| version()    |
+--------------+
| 5.7.8-rc-log |
+--------------+
1 row in set (0.00 sec)

Problem:
===
"select cast('' as signed) union all select ''" is expected to return:
+--------------------+
| 0                  |
|                    |
+--------------------+

How to repeat:
select cast('' as signed) union all select '';
select cast('' as signed) union all select 'a';

Suggested fix:
"select cast('' as signed) union all select ''" returns:
+--------------------+
| 0                  |
|                    |
+--------------------+
[1 Jun 2016 11:27] MySQL Verification Team
Hello Su Dylan,

Thank you for the report and test case.

Thanks,
Umesh