From b2f86ebdd254d923daf6f29e64e61e19187044b9 Mon Sep 17 00:00:00 2001 From: Igor Babaev Date: Thu, 31 May 2018 18:55:07 -0700 Subject: MDEV-16353 Server crash on query with CTE This bug caused crashes for queries with unreferenced non-recursive CTEs specified by unions.It happened because the function st_select_lex_unit::prepare() tried to use the value of the field 'derived' that could not be set for unferenced CTEs as there was no derived table associated with an unreferenced CTE. --- sql/sql_union.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sql/sql_union.cc') diff --git a/sql/sql_union.cc b/sql/sql_union.cc index 13c19dae342..178d7393878 100644 --- a/sql/sql_union.cc +++ b/sql/sql_union.cc @@ -625,7 +625,7 @@ bool st_select_lex_unit::prepare(THD *thd_arg, select_result *sel_result, { if (with_element) { - if (derived->with->rename_columns_of_derived_unit(thd, this)) + if (with_element->rename_columns_of_derived_unit(thd, this)) goto err; if (check_duplicate_names(thd, sl->item_list, 0)) goto err; -- cgit v1.2.1