summaryrefslogtreecommitdiff
path: root/mysql-test/main/derived_view.result
diff options
context:
space:
mode:
authorIgor Babaev <igor@askmonty.org>2021-06-21 22:25:37 -0700
committerIgor Babaev <igor@askmonty.org>2021-06-21 22:25:37 -0700
commit6e94ef41859cc628f92224e33dd661d9a4be215b (patch)
treed0ad0e9a1f39ab4f905d5ba3b423ee623f6a9767 /mysql-test/main/derived_view.result
parent9dc50ea2293640f8153bc806612fd72634498010 (diff)
downloadmariadb-git-6e94ef41859cc628f92224e33dd661d9a4be215b.tar.gz
MDEV-25679 Wrong result selecting from simple view with LIMIT and ORDER BY
This bug affected queries with views / derived_tables / CTEs whose specifications were of the form (SELECT ... LIMIT <n>) ORDER BY ... Units representing such specifications contains one SELECT_LEX structure for (SELECT ... LIMIT <n>) and additionally SELECT_LEX structure for fake_select_lex. This fact should have been taken into account in the function mysql_derived_fill(). This patch has to be applied to 10.2 and 10.3 only.
Diffstat (limited to 'mysql-test/main/derived_view.result')
-rw-r--r--mysql-test/main/derived_view.result21
1 files changed, 21 insertions, 0 deletions
diff --git a/mysql-test/main/derived_view.result b/mysql-test/main/derived_view.result
index dd0cac74d28..65a1adcaddd 100644
--- a/mysql-test/main/derived_view.result
+++ b/mysql-test/main/derived_view.result
@@ -3478,3 +3478,24 @@ Warnings:
Note 1003 select `test`.`t1`.`pk` AS `pk`,`test`.`t1`.`a` AS `a`,3 AS `d`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`c` AS `c` from `test`.`t1` join `test`.`t2` join `test`.`t3` where `test`.`t1`.`a` = 3 and `test`.`t1`.`pk` <= 2
drop view v1;
drop table t1,t2,t3;
+#
+# MDEV-25679: view / derived table defined as ordered select with LIMIT
+#
+create table t1 (a int);
+insert into t1 values (3), (7), (1);
+create view v1 as (select a from t1 limit 2) order by a desc;
+(select a from t1 limit 2) order by a desc;
+a
+7
+3
+select * from v1;
+a
+7
+3
+select * from ((select a from t1 limit 2) order by a desc) dt;
+a
+7
+3
+drop view v1;
+drop table t1;
+# End of 10.2 tests