Commit 81c1abe8 authored by Igor Babaev's avatar Igor Babaev

Fixed bug mdev-10875.

Now, after the implementation of mdev-8646
"Re-engineer the code for post-join operations"
create_sort_index() can be called for subqueries.
parent 1d96b098
......@@ -2382,3 +2382,19 @@ pk c CNT
10 2 0.5000
drop view v1,v2,v3,v4;
drop table t0,t1;
#
# MDEV-10875: window function in subquery
#
CREATE TABLE t1 (i INT);
INSERT INTO t1 VALUES (3),(1);
CREATE TABLE t2 (c VARCHAR(8));
INSERT INTO t2 VALUES ('foo'),('bar'),('foo');
SELECT COUNT(*) OVER (PARTITION BY c) FROM t2;
COUNT(*) OVER (PARTITION BY c)
2
1
2
SELECT * FROM t1 WHERE i IN ( SELECT COUNT(*) OVER (PARTITION BY c) FROM t2 );
i
1
DROP TABLE t1, t2;
......@@ -1426,3 +1426,19 @@ select * from v4;
drop view v1,v2,v3,v4;
drop table t0,t1;
--echo #
--echo # MDEV-10875: window function in subquery
--echo #
CREATE TABLE t1 (i INT);
INSERT INTO t1 VALUES (3),(1);
CREATE TABLE t2 (c VARCHAR(8));
INSERT INTO t2 VALUES ('foo'),('bar'),('foo');
SELECT COUNT(*) OVER (PARTITION BY c) FROM t2;
SELECT * FROM t1 WHERE i IN ( SELECT COUNT(*) OVER (PARTITION BY c) FROM t2 );
DROP TABLE t1, t2;
......@@ -21403,9 +21403,6 @@ create_sort_index(THD *thd, JOIN *join, JOIN_TAB *tab, Filesort *fsort)
table= tab->table;
select= fsort->select;
/* Currently ORDER BY ... LIMIT is not supported in subqueries. */
DBUG_ASSERT(join->group_list || !join->is_in_subquery());
table->status=0; // May be wrong if quick_select
if (!tab->preread_init_done && tab->preread_init())
......
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