Description:
In the following three queries, the first two return results with three decimal places, but the last query only retains one decimal place.
mysql> SELECT ALL concat(t0.c0,'') FROM t0;
+------------------+
| concat(t0.c0,'') |
+------------------+
| 0.072 |
| 0.199 |
+------------------+
2 rows in set (0.00 sec)
mysql> SELECT ALL concat(t0.c0,'') FROM t0 WHERE (NOT ( EXISTS (SELECT 1 from dual wHERE FALSE)));
+------------------+
| concat(t0.c0,'') |
+------------------+
| 0.072 |
| 0.199 |
+------------------+
2 rows in set (0.00 sec)
mysql> SELECT ALL concat(t0.c0,'') FROM t0 WHERE (NOT ( EXISTS (SELECT 1 from dual wHERE FALSE))) UNION ALL SELECT ALL concat(t0.c0,'') FROM t0 WHERE EXISTS (SELECT 1 from dual wHERE FALSE) UNION ALL SELECT ALL concat(t0.c0,'') FROM t0 WHERE ( EXISTS (SELECT 1 from dual wHERE FALSE)) IS UNKNOWN;
+------------------+
| concat(t0.c0,'') |
+------------------+
| 0.0 |
| 0.1 |
+------------------+
2 rows in set (0.00 sec)
How to repeat:
DROP TABLE IF EXISTS `t0`;
CREATE TABLE `t0` (
`c0` float(3,3) unsigned DEFAULT NULL
) ;
INSERT INTO `t0` VALUES (0.072),(0.199);
SELECT ALL concat(t0.c0,'') FROM t0;
SELECT ALL concat(t0.c0,'') FROM t0 WHERE (NOT ( EXISTS (SELECT 1 from dual wHERE FALSE)));
SELECT ALL concat(t0.c0,'') FROM t0 WHERE (NOT ( EXISTS (SELECT 1 from dual wHERE FALSE))) UNION ALL SELECT ALL concat(t0.c0,'') FROM t0 WHERE EXISTS (SELECT 1 from dual wHERE FALSE) UNION ALL SELECT ALL concat(t0.c0,'') FROM t0 WHERE ( EXISTS (SELECT 1 from dual wHERE FALSE)) IS UNKNOWN;
Suggested fix:
The execution plan of the last one is different from the previous ones. This might be the reason.