diff options
author | Igor Babaev <igor@askmonty.org> | 2021-06-21 16:15:07 -0700 |
---|---|---|
committer | Igor Babaev <igor@askmonty.org> | 2021-06-21 16:21:17 -0700 |
commit | cc0bd8431f9a2b252697afab78e039b8cd294d01 (patch) | |
tree | 352d0781050a1806a2cb430d1ffb77e6945da832 /sql/sql_derived.cc | |
parent | 773a07b65517327add6348c045cee14bdf489fe0 (diff) | |
download | mariadb-git-cc0bd8431f9a2b252697afab78e039b8cd294d01.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 3ab93840d80..632baf4bc5b 100644 --- a/sql/sql_derived.cc +++ b/sql/sql_derived.cc @@ -1091,7 +1091,7 @@ bool mysql_derived_fill(THD *thd, LEX *lex, TABLE_LIST *derived) res= derived->fill_recursive(thd); } } - else if (unit->is_union()) + else if (unit->is_union() || unit->fake_select_lex) { // execute union without clean up res= unit->exec(); |