From 49e14000eeb245ea27e9207d2f63cb0a28be1ca9 Mon Sep 17 00:00:00 2001 From: Oleg Smirnov Date: Sat, 18 Jun 2022 20:54:39 +0700 Subject: MDEV-26427 MariaDB Server SEGV on INSERT .. SELECT 1. For INSERT..SELECT statements: don't include table/view the data is inserted into in the list of leaf tables 2. Remove duplicated and dead code related to table_count --- sql/sql_insert.cc | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'sql/sql_insert.cc') diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc index 38551867902..a180147190b 100644 --- a/sql/sql_insert.cc +++ b/sql/sql_insert.cc @@ -1429,8 +1429,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->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); @@ -3641,7 +3640,6 @@ bool mysql_insert_select_prepare(THD *thd) &select_lex->where, TRUE)) DBUG_RETURN(TRUE); - DBUG_ASSERT(select_lex->leaf_tables.elements != 0); List_iterator ti(select_lex->leaf_tables); TABLE_LIST *table; uint insert_tables; -- cgit v1.2.1