1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

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.
This commit is contained in:
Igor Babaev
2021-06-21 22:25:37 -07:00
parent 9dc50ea229
commit 6e94ef4185
3 changed files with 39 additions and 1 deletions

View File

@ -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();