diff options
author | Igor Babaev <igor@askmonty.org> | 2021-06-21 22:25:37 -0700 |
---|---|---|
committer | Igor Babaev <igor@askmonty.org> | 2021-06-21 22:25:37 -0700 |
commit | 6e94ef41859cc628f92224e33dd661d9a4be215b (patch) | |
tree | d0ad0e9a1f39ab4f905d5ba3b423ee623f6a9767 /sql/sql_derived.cc | |
parent | 9dc50ea2293640f8153bc806612fd72634498010 (diff) | |
download | mariadb-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 'sql/sql_derived.cc')
-rw-r--r-- | sql/sql_derived.cc | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/sql/sql_derived.cc b/sql/sql_derived.cc index e2e30f35206..8f10013bed1 100644 --- a/sql/sql_derived.cc +++ b/sql/sql_derived.cc @@ -1163,7 +1163,7 @@ bool mysql_derived_fill(THD *thd, LEX *lex, TABLE_LIST *derived) res= derived->fill_recursive(thd); } } - else if (unit->is_unit_op()) + else if (unit->is_unit_op() || unit->fake_select_lex) { // execute union without clean up res= unit->exec(); |