summaryrefslogtreecommitdiff
path: root/mysql-test/t/win.test
diff options
context:
space:
mode:
authorSergei Petrunia <psergey@askmonty.org>2017-07-21 18:02:53 +0300
committerSergei Petrunia <psergey@askmonty.org>2017-07-21 20:20:14 +0300
commit4bdf9318b6bab1bf8d3718c50f87871a4ae5ec9b (patch)
tree532546459dc47c60921c382e572279adeaea0b3a /mysql-test/t/win.test
parent2a1035b004dfabcf3a7113be632b0030721a44d6 (diff)
downloadmariadb-git-bb-10.2-mdev13355.tar.gz
MDEV-13355: Assertion `using_unique_constraint || group_buff <= param->group_buff...bb-10.2-mdev13355
The code in OIN::optimize_inner() has this call calc_group_buffer(this, group_list) the call is however bypassed when the optimizer figures out that the JOIN has "Impossible WHERE". If we attempt to calculate the value of a window function afterwards, we will get a crash when trying to create a temporary table. So, put a call to calc_group_buffer() here as well. It's a bit surprising that all these steps are done for a query that will produce zero rows but we are just following the approach taken by the fix for mdev-11999 here.
Diffstat (limited to 'mysql-test/t/win.test')
-rw-r--r--mysql-test/t/win.test17
1 files changed, 16 insertions, 1 deletions
diff --git a/mysql-test/t/win.test b/mysql-test/t/win.test
index 77ca755378d..9de4fd66fc5 100644
--- a/mysql-test/t/win.test
+++ b/mysql-test/t/win.test
@@ -1953,4 +1953,19 @@ UNION ALL
( SELECT Nth_value(i,2) OVER() FROM t1 LIMIT 0 )
;
DROP TABLE t1;
-
+--echo #
+--echo # MDEV-13355: Assertion `using_unique_constraint || group_buff <= param->group_buff +
+--echo # param->group_length' failed in create_tmp_table
+--echo #
+CREATE TABLE t1 (i INT);
+INSERT INTO t1 VALUES (1),(2);
+
+SELECT * FROM (
+ SELECT
+ ROW_NUMBER() OVER(), i
+ FROM t1
+ WHERE 1=0
+ GROUP BY i
+) AS sq
+;
+DROP TABLE t1;