diff options
author | Oleksandr Byelkin <sanja@mariadb.com> | 2015-11-20 14:50:18 +0100 |
---|---|---|
committer | Oleksandr Byelkin <sanja@mariadb.com> | 2015-11-20 14:50:18 +0100 |
commit | 13ad179c96ee8c8c4043806b8575c851e3676f0d (patch) | |
tree | 511bda3b78aa60c5fa44af0430077cef752a8500 /sql | |
parent | 43a5090980ac0ab9695587979b9068b6bf849d64 (diff) | |
download | mariadb-git-13ad179c96ee8c8c4043806b8575c851e3676f0d.tar.gz |
MDEV-8756 MariaDB 10.0.21 crashes during PREPARE
Non-select-like queries has no correct JOIN structure connected to top-most SELECT_LEX (and should not).
Diffstat (limited to 'sql')
-rw-r--r-- | sql/item.cc | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/sql/item.cc b/sql/item.cc index 840272c57a4..6d2983f249d 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -4889,8 +4889,24 @@ Item_field::fix_outer_field(THD *thd, Field **from_field, Item **reference) As this is an outer field it should be added to the list of non aggregated fields of the outer select. */ - marker= select->cur_pos_in_select_list; - select->join->non_agg_fields.push_back(this); + if (select->join) + { + marker= select->cur_pos_in_select_list; + select->join->non_agg_fields.push_back(this); + } + else + { + /* + join is absent if it is upper SELECT_LEX of non-select + command + */ + DBUG_ASSERT(select->master_unit()->outer_select() == NULL && + (thd->lex->sql_command != SQLCOM_SELECT && + thd->lex->sql_command != SQLCOM_UPDATE_MULTI && + thd->lex->sql_command != SQLCOM_DELETE_MULTI && + thd->lex->sql_command != SQLCOM_INSERT_SELECT && + thd->lex->sql_command != SQLCOM_REPLACE_SELECT)); + } } if (*from_field != view_ref_found) { |