summaryrefslogtreecommitdiff
path: root/mysql-test/t/union.test
diff options
context:
space:
mode:
authorAlexey Kopytov <Alexey.Kopytov@sun.com>2009-03-27 13:12:50 +0300
committerAlexey Kopytov <Alexey.Kopytov@sun.com>2009-03-27 13:12:50 +0300
commitafb2b6de68084b7aa5daa05cfc8ccac9fdeabf5d (patch)
tree25ffdefedc9a553afb5467a7752e34c85a3abbf9 /mysql-test/t/union.test
parent8725bcd94402800ac2d87f94dfecd5a202d80497 (diff)
downloadmariadb-git-afb2b6de68084b7aa5daa05cfc8ccac9fdeabf5d.tar.gz
Fix for bug #43432: Union on floats does unnecessary rounding
UNION could convert fixed-point FLOAT(M,D)/DOUBLE(M,D) columns to FLOAT/DOUBLE when aggregating data types from the SELECT substatements. While there is nothing particularly wrong with this behavior, especially when M is greater than the hardware precision limits, it could be confusing in cases when all SELECT statements in a union have the same FLOAT(M,D)/DOUBLE(M,D) columns with equal precision specifications listed in the same position. Since the manual is quite vague on what data type should be returned in such cases, the bug was fixed by implementing the most 'expected' behavior: do not convert FLOAT(M,D)/DOUBLE(M,D) to anything else if all SELECT statements in a UNION have the same precision for that column.
Diffstat (limited to 'mysql-test/t/union.test')
-rw-r--r--mysql-test/t/union.test15
1 files changed, 15 insertions, 0 deletions
diff --git a/mysql-test/t/union.test b/mysql-test/t/union.test
index 44f21abda19..35b9be60f2b 100644
--- a/mysql-test/t/union.test
+++ b/mysql-test/t/union.test
@@ -1000,4 +1000,19 @@ SELECT * FROM (SELECT * FROM (SELECT NULL)a) b UNION SELECT a FROM t1;
DESC t6;
DROP TABLE t1, t2, t3, t4, t5, t6;
+
+#
+# Bug #43432: Union on floats does unnecessary rounding
+#
+
+CREATE TABLE t1 (f FLOAT(9,6));
+CREATE TABLE t2 AS SELECT f FROM t1 UNION SELECT f FROM t1;
+SHOW FIELDS FROM t2;
+DROP TABLE t1, t2;
+
+CREATE TABLE t1(d DOUBLE(9,6));
+CREATE TABLE t2 AS SELECT d FROM t1 UNION SELECT d FROM t1;
+SHOW FIELDS FROM t2;
+DROP TABLE t1, t2;
+
--echo End of 5.0 tests