diff options
Diffstat (limited to 'sql/sql_insert.cc')
-rw-r--r-- | sql/sql_insert.cc | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc index 10dab7db4a0..14a83442829 100644 --- a/sql/sql_insert.cc +++ b/sql/sql_insert.cc @@ -1346,8 +1346,12 @@ values_loop_end: thd->lex->current_select->save_leaf_tables(thd); thd->lex->current_select->first_cond_optimization= 0; } - if (readbuff) - my_free(readbuff); + + my_free(readbuff); +#ifndef EMBEDDED_LIBRARY + if (lock_type == TL_WRITE_DELAYED && table->expr_arena) + table->expr_arena->free_items(); +#endif DBUG_RETURN(FALSE); abort: @@ -1364,6 +1368,8 @@ abort: */ for (Field **ptr= table_list->table->field ; *ptr ; ptr++) (*ptr)->free(); + if (table_list->table->expr_arena) + table_list->table->expr_arena->free_items(); } #endif if (table != NULL) @@ -1542,8 +1548,7 @@ static bool mysql_prepare_insert_check_table(THD *thd, TABLE_LIST *table_list, if (insert_into_view && !fields.elements) { thd->lex->empty_field_list_on_rset= 1; - if (!thd->lex->first_select_lex()->leaf_tables.head()->table || - table_list->is_multitable()) + if (!table_list->table || table_list->is_multitable()) { my_error(ER_VIEW_NO_INSERT_FIELD_LIST, MYF(0), table_list->view_db.str, table_list->view_name.str); @@ -3789,7 +3794,6 @@ int mysql_insert_select_prepare(THD *thd, select_result *sel_res) if (sel_res) sel_res->prepare(lex->returning()->item_list, NULL); - DBUG_ASSERT(select_lex->leaf_tables.elements != 0); List_iterator<TABLE_LIST> ti(select_lex->leaf_tables); TABLE_LIST *table; uint insert_tables; |