From 796d54df115a0e5485a7df0835088a51dd0f9e77 Mon Sep 17 00:00:00 2001 From: Oleksandr Byelkin Date: Thu, 30 Aug 2018 15:18:35 +0200 Subject: MDEV-16957: Server crashes in Field_iterator_natural_join::next upon 2nd execution of SP The problem was that join_columns creation was not finished due to error of notfound column in USING, but next execution tried to use join_columns lists. Solution is cleanup the lists on error. It can eat memory in statement MEM_ROOT but it is an error and error will be fixed or statement/procedure removed/altered. --- sql/table.h | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'sql/table.h') diff --git a/sql/table.h b/sql/table.h index 1d4a1d9a2d2..4725eb96432 100644 --- a/sql/table.h +++ b/sql/table.h @@ -2184,6 +2184,16 @@ struct TABLE_LIST } void set_lock_type(THD* thd, enum thr_lock_type lock); + void remove_join_columns() + { + if (join_columns) + { + join_columns->empty(); + join_columns= NULL; + is_join_columns_complete= FALSE; + } + } + private: bool prep_check_option(THD *thd, uint8 check_opt_type); bool prep_where(THD *thd, Item **conds, bool no_where_clause); -- cgit v1.2.1