summaryrefslogtreecommitdiff
path: root/sql/sql_update.cc
diff options
context:
space:
mode:
authorJoerg Bruehe <joerg@mysql.com>2008-12-10 21:14:50 +0100
committerJoerg Bruehe <joerg@mysql.com>2008-12-10 21:14:50 +0100
commit05cfb22814574933a5fd603afcc0ad64fde5ad26 (patch)
tree0808625d28751a07f6894b2bffcf47fcf1e71fbf /sql/sql_update.cc
parent8ce289d23629e2f0817386bd6fc8be1fb6afc954 (diff)
parentad41e2e7e0d55737eb5f21ee41945c73238828c9 (diff)
downloadmariadb-git-05cfb22814574933a5fd603afcc0ad64fde5ad26.tar.gz
Merge main 5.1 into 5.1-build
Diffstat (limited to 'sql/sql_update.cc')
-rw-r--r--sql/sql_update.cc31
1 files changed, 31 insertions, 0 deletions
diff --git a/sql/sql_update.cc b/sql/sql_update.cc
index ff47f5e4cd7..f448fb7ab50 100644
--- a/sql/sql_update.cc
+++ b/sql/sql_update.cc
@@ -715,6 +715,11 @@ int mysql_update(THD *thd,
else
table->file->unlock_row();
thd->row_count++;
+ if (thd->is_error())
+ {
+ error= 1;
+ break;
+ }
}
dup_key_found= 0;
/*
@@ -1470,6 +1475,32 @@ multi_update::initialize_tables(JOIN *join)
}
table->prepare_for_position();
+ /*
+ enable uncacheable flag if we update a view with check option
+ and check option has a subselect, otherwise, the check option
+ can be evaluated after the subselect was freed as independent
+ (See full_local in JOIN::join_free()).
+ */
+ if (table_ref->check_option && !join->select_lex->uncacheable)
+ {
+ SELECT_LEX_UNIT *tmp_unit;
+ SELECT_LEX *sl;
+ for (tmp_unit= join->select_lex->first_inner_unit();
+ tmp_unit;
+ tmp_unit= tmp_unit->next_unit())
+ {
+ for (sl= tmp_unit->first_select(); sl; sl= sl->next_select())
+ {
+ if (sl->master_unit()->item)
+ {
+ join->select_lex->uncacheable|= UNCACHEABLE_CHECKOPTION;
+ goto loop_end;
+ }
+ }
+ }
+ }
+loop_end:
+
if (table == first_table_for_update && table_ref->check_option)
{
table_map unupdated_tables= table_ref->check_option->used_tables() &