summaryrefslogtreecommitdiff
path: root/sql/sql_update.cc
diff options
context:
space:
mode:
authorIgor Babaev <igor@askmonty.org>2011-07-16 23:57:43 -0700
committerIgor Babaev <igor@askmonty.org>2011-07-16 23:57:43 -0700
commitd37465a9cc458ab215105de22875ce0a64c0efc2 (patch)
tree2fc2c3e0ee8a246b65001039b7651a2f38091608 /sql/sql_update.cc
parent6e5413853e9788b7e86808c8765983f8724122d8 (diff)
downloadmariadb-git-d37465a9cc458ab215105de22875ce0a64c0efc2.tar.gz
Fixed LP bug #794901.
Also: 1. simplified the code of the function mysql_derived_merge_for_insert. 2. moved merge of views/dt for multi-update/delete to the prepare stage. 3. the list of the references to the candidates for semi-join now is allocated in the statement memory.
Diffstat (limited to 'sql/sql_update.cc')
-rw-r--r--sql/sql_update.cc15
1 files changed, 6 insertions, 9 deletions
diff --git a/sql/sql_update.cc b/sql/sql_update.cc
index 91be30b076b..b516065eff7 100644
--- a/sql/sql_update.cc
+++ b/sql/sql_update.cc
@@ -248,6 +248,7 @@ int mysql_update(THD *thd,
DBUG_RETURN(1);
close_tables_for_reopen(thd, &table_list);
}
+
if (table_list->handle_derived(thd->lex, DT_MERGE_FOR_INSERT))
DBUG_RETURN(1);
if (table_list->handle_derived(thd->lex, DT_PREPARE))
@@ -1037,10 +1038,10 @@ reopen_tables:
second time, but this call will do nothing (there are check for second
call in setup_tables()).
*/
+
//We need to merge for insert prior to prepare.
if (mysql_handle_derived(lex, DT_MERGE_FOR_INSERT))
DBUG_RETURN(TRUE);
-
if (mysql_handle_derived(lex, DT_PREPARE))
DBUG_RETURN(TRUE);
@@ -1048,7 +1049,10 @@ reopen_tables:
&lex->select_lex.top_join_list,
table_list,
lex->select_lex.leaf_tables, FALSE,
- UPDATE_ACL, SELECT_ACL, TRUE))
+ UPDATE_ACL, SELECT_ACL, FALSE))
+ DBUG_RETURN(TRUE);
+
+ if (lex->select_lex.handle_derived(thd->lex, DT_MERGE))
DBUG_RETURN(TRUE);
if (setup_fields_with_no_wrap(thd, 0, *fields, MARK_COLUMNS_WRITE, 0, 0))
@@ -1334,13 +1338,6 @@ int multi_update::prepare(List<Item> &not_used_values,
thd->cuted_fields=0L;
thd_proc_info(thd, "updating main table");
- SELECT_LEX *select_lex= lex_unit->first_select();
- if (select_lex->first_cond_optimization)
- {
- if (select_lex->handle_derived(thd->lex, DT_MERGE))
- DBUG_RETURN(TRUE);
- }
-
tables_to_update= get_table_map(fields);
if (!tables_to_update)