From e19b07e657eb94a9d09ff39947287a020de314f3 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Thu, 7 Aug 2014 21:45:54 +0200 Subject: crash in main.views (and other view + PS tests) When a view is merged, mark its select_lex as already optimized, otherwise its where clause (which doesn't have to be a valid Item after merging) might be accessed later. But don't do that for inserts (where a view cannot be simply merged, if one later needs to insert into it). --- sql/sql_derived.cc | 2 ++ 1 file changed, 2 insertions(+) (limited to 'sql/sql_derived.cc') diff --git a/sql/sql_derived.cc b/sql/sql_derived.cc index c62fb81334a..8e8dbfc71d4 100644 --- a/sql/sql_derived.cc +++ b/sql/sql_derived.cc @@ -465,6 +465,8 @@ bool mysql_derived_merge(THD *thd, LEX *lex, TABLE_LIST *derived) } } + if (!derived->merged_for_insert) + dt_select->first_cond_optimization= FALSE; // consider it optimized exit_merge: if (arena) thd->restore_active_arena(arena, &backup); -- cgit v1.2.1