diff options
| author | Marko Mäkelä <marko.makela@mariadb.com> | 2021-04-25 12:04:45 +0300 |
|---|---|---|
| committer | Marko Mäkelä <marko.makela@mariadb.com> | 2021-04-25 12:04:45 +0300 |
| commit | 4725792bf3ca17b581586f54a2e0058b4a18cff1 (patch) | |
| tree | 0c1ae1ec376660682d940027fe70bd6d4e8afe58 /sql/sql_delete.cc | |
| parent | b8fad8c6bffbc7e43796fffe607b23075cfc3e2b (diff) | |
| parent | e4394cc5472a18d791b48e56784742b512de2bf8 (diff) | |
| download | mariadb-git-4725792bf3ca17b581586f54a2e0058b4a18cff1.tar.gz | |
Merge 10.4 into 10.5
Diffstat (limited to 'sql/sql_delete.cc')
| -rw-r--r-- | sql/sql_delete.cc | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/sql/sql_delete.cc b/sql/sql_delete.cc index 94d5ceb309d..cf411d01f38 100644 --- a/sql/sql_delete.cc +++ b/sql/sql_delete.cc @@ -1,6 +1,6 @@ /* Copyright (c) 2000, 2019, Oracle and/or its affiliates. - Copyright (c) 2010, 2019, MariaDB + Copyright (c) 2010, 2021, MariaDB This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -1109,14 +1109,11 @@ int mysql_multi_delete_prepare(THD *thd) FALSE, DELETE_ACL, SELECT_ACL, FALSE)) DBUG_RETURN(TRUE); - if (lex->first_select_lex()->handle_derived(thd->lex, DT_MERGE)) - DBUG_RETURN(TRUE); - /* Multi-delete can't be constructed over-union => we always have single SELECT on top and have to check underlying SELECTs of it */ - lex->first_select_lex()->exclude_from_table_unique_test= TRUE; + lex->first_select_lex()->set_unique_exclude(); /* Fix tables-to-be-deleted-from list to point at opened tables */ for (target_tbl= (TABLE_LIST*) aux_tables; target_tbl; @@ -1139,6 +1136,12 @@ int mysql_multi_delete_prepare(THD *thd) target_tbl->table_name.str, "DELETE"); DBUG_RETURN(TRUE); } + } + + for (target_tbl= (TABLE_LIST*) aux_tables; + target_tbl; + target_tbl= target_tbl->next_local) + { /* Check that table from which we delete is not used somewhere inside subqueries/view. @@ -1183,12 +1186,6 @@ multi_delete::prepare(List<Item> &values, SELECT_LEX_UNIT *u) unit= u; do_delete= 1; THD_STAGE_INFO(thd, stage_deleting_from_main_table); - SELECT_LEX *select_lex= u->first_select(); - if (select_lex->first_cond_optimization) - { - if (select_lex->handle_derived(thd->lex, DT_MERGE)) - DBUG_RETURN(TRUE); - } DBUG_RETURN(0); } |
