Commit 253aa7bb authored by Varun Gupta's avatar Varun Gupta

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
parent dba7e1e8
......@@ -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
#
......@@ -2472,6 +2472,15 @@ SELECT NTILE(MAX(a) OVER (PARTITION BY a)) OVER (PARTITION BY a ORDER BY b) FROM
SELECT FIRST_VALUE(MAX(a) OVER (PARTITION BY a)) OVER (ORDER BY a) AS x FROM t1 GROUP BY a;
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 #
......@@ -953,6 +953,7 @@ class Item_window_func : public Item_func_or_sum
bool fix_length_and_dec()
{
decimals = window_func()->decimals;
unsigned_flag= window_func()->unsigned_flag;
return FALSE;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment