summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVarun Gupta <varun.gupta@mariadb.com>2020-07-07 17:30:52 +0530
committerVarun Gupta <varun.gupta@mariadb.com>2020-07-07 17:30:53 +0530
commit253aa7bbc4dda77427f6b1bf47620db36ada75b9 (patch)
tree73827327d483d4b90a2ea7818022dacfcd705115
parentdba7e1e8e14254c9de61e74b7e68cdbbad0038a8 (diff)
downloadmariadb-git-253aa7bbc4dda77427f6b1bf47620db36ada75b9.tar.gz
MDEV-12059: Assertion `precision > 0' failed with a window function or window aggregate function
Pass the unsigned flag from the Item_sum to the window function
-rw-r--r--mysql-test/r/win.result10
-rw-r--r--mysql-test/t/win.test9
-rw-r--r--sql/item_windowfunc.h1
3 files changed, 20 insertions, 0 deletions
diff --git a/mysql-test/r/win.result b/mysql-test/r/win.result
index 9c85315b7c1..71953871295 100644
--- a/mysql-test/r/win.result
+++ b/mysql-test/r/win.result
@@ -3798,5 +3798,15 @@ SELECT FIRST_VALUE(MAX(a) OVER (PARTITION BY a)) OVER (ORDER BY a) AS x FROM t1
ERROR HY000: Window functions can not be used as arguments to group functions.
DROP TABLE t1;
#
+# MDEV-12059: Assertion `precision > 0' failed with a window function or window aggregate function
+#
+CREATE TABLE t1 (d DECIMAL(1,0) UNSIGNED);
+INSERT INTO t1 VALUES (1),(2);
+SELECT MIN(d) OVER () FROM t1;
+MIN(d) OVER ()
+1
+1
+DROP TABLE t1;
+#
# End of 10.2 tests
#
diff --git a/mysql-test/t/win.test b/mysql-test/t/win.test
index d19ff2c624d..a768b893432 100644
--- a/mysql-test/t/win.test
+++ b/mysql-test/t/win.test
@@ -2473,5 +2473,14 @@ SELECT FIRST_VALUE(MAX(a) OVER (PARTITION BY a)) OVER (ORDER BY a) AS x FROM t1
DROP TABLE t1;
--echo #
+--echo # MDEV-12059: Assertion `precision > 0' failed with a window function or window aggregate function
+--echo #
+
+CREATE TABLE t1 (d DECIMAL(1,0) UNSIGNED);
+INSERT INTO t1 VALUES (1),(2);
+SELECT MIN(d) OVER () FROM t1;
+DROP TABLE t1;
+
+--echo #
--echo # End of 10.2 tests
--echo #
diff --git a/sql/item_windowfunc.h b/sql/item_windowfunc.h
index b9df1b7482b..85957949053 100644
--- a/sql/item_windowfunc.h
+++ b/sql/item_windowfunc.h
@@ -953,6 +953,7 @@ public:
bool fix_length_and_dec()
{
decimals = window_func()->decimals;
+ unsigned_flag= window_func()->unsigned_flag;
return FALSE;
}