summaryrefslogtreecommitdiff
path: root/mysql-test/r
diff options
context:
space:
mode:
authorAlexander Barkov <bar@mariadb.org>2015-10-08 20:48:46 +0400
committerAlexander Barkov <bar@mariadb.org>2015-10-08 20:48:46 +0400
commit16ad1fc54027c4607f9edd14b02f776b41393f16 (patch)
tree534f8608a49b3d77774a9ed1cf9412a433f83cac /mysql-test/r
parent7091b7852d27e6c8a1875b2acc0d1adbfb29984f (diff)
downloadmariadb-git-16ad1fc54027c4607f9edd14b02f776b41393f16.tar.gz
MDEV-8921 Wrong result for CAST(AVG(double_column) AS SIGNED)
Diffstat (limited to 'mysql-test/r')
-rw-r--r--mysql-test/r/func_group.result16
1 files changed, 16 insertions, 0 deletions
diff --git a/mysql-test/r/func_group.result b/mysql-test/r/func_group.result
index 652633b09d1..023b0091357 100644
--- a/mysql-test/r/func_group.result
+++ b/mysql-test/r/func_group.result
@@ -2298,5 +2298,21 @@ id avg cast_avg
2 9223372036854775807.0000 9223372036854775807
DROP TABLE t1;
#
+# MDEV-8921 Wrong result for CAST(AVG(double_column) AS SIGNED)
+#
+CREATE TABLE t1 (id INT, a DOUBLE);
+INSERT INTO t1 VALUES (1,0x7FFFFFFFFFFFFFFF),(2,0x7FFFFFFFFFFFFFFF);
+SELECT id, AVG(a) AS avg, CAST(MIN(a) AS SIGNED) AS cast_min,CAST(AVG(a) AS SIGNED) AS cast_avg FROM t1 GROUP BY id HAVING avg!=123 ORDER BY id;
+id avg cast_min cast_avg
+1 9.223372036854776e18 9223372036854775807 9223372036854775807
+2 9.223372036854776e18 9223372036854775807 9223372036854775807
+DROP TABLE t1;
+CREATE TABLE t1 (a DOUBLE);
+INSERT INTO t1 VALUES (0x7FFFFFFFFFFFFFFF);
+SELECT MIN(a), SUM(a), CAST(SUM(a) AS SIGNED), CAST(AVG(a) AS SIGNED) FROM t1;
+MIN(a) SUM(a) CAST(SUM(a) AS SIGNED) CAST(AVG(a) AS SIGNED)
+9.223372036854776e18 9.223372036854776e18 9223372036854775807 9223372036854775807
+DROP TABLE t1;
+#
# End of 10.1 tests
#