mirror of
https://github.com/MariaDB/server.git
synced 2026-05-07 23:54:31 +02:00
MDEV-5104 crash in Item_field::used_tables with broken order by
Analysis: st_select_lex_unit::prepare() computes can_skip_order_by as TRUE. As a result join->prepare() gets called with order == NULL, and doesn't do name resolution for the inner ORDER clause. Due to this the prepare phase doesn't detect that the query references non-exiting function and field. Later join->optimize() calls update_used_tables() for a non-resolved Item_field, which understandably has no Field object. This call results in a crash. Solution: Resolve unnecessary ORDER BY clauses to detect if they reference non-exising objects. Then remove such clauses from the JOIN object.
This commit is contained in:
parent
94ad392fd8
commit
883af99e7d
11 changed files with 36 additions and 13 deletions
|
|
@ -2928,6 +2928,7 @@ int subselect_single_select_engine::prepare()
|
|||
select_lex->order_list.elements +
|
||||
select_lex->group_list.elements,
|
||||
select_lex->order_list.first,
|
||||
false,
|
||||
select_lex->group_list.first,
|
||||
select_lex->having,
|
||||
NULL, select_lex,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue