Bug #119287 Decimal Precision Mismatch in UNION Query with CONCAT Function
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.
Portions of this website are copyright © 2001, 2002 The PHP Group
Page generated in 0.038 sec. using MySQL 8.4.7-u6-cloud
Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the
respective copyright holders.
It is not reviewed in advance
by Oracle and does not necessarily represent the opinion of
Oracle or any other party.