summaryrefslogtreecommitdiff
path: root/sql/sql_update.cc
diff options
context:
space:
mode:
authorSergey Glukhov <Sergey.Glukhov@sun.com>2008-11-27 17:57:34 +0400
committerSergey Glukhov <Sergey.Glukhov@sun.com>2008-11-27 17:57:34 +0400
commit89d044062c1daa3f12358b003478cbaa5df91e3b (patch)
treef265c4908fcf06cb205a4e7df8f61403bdd26a02 /sql/sql_update.cc
parent73960af037a68dd96ae636ff84b39007f825ab0e (diff)
downloadmariadb-git-89d044062c1daa3f12358b003478cbaa5df91e3b.tar.gz
Bug#37460 Assertion failed: !table->file || table->file->inited == handler::NONE
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()) mysql-test/r/subselect.result: test result mysql-test/t/subselect.test: test case sql/mysql_priv.h: added UNCACHEABLE_CHECKOPTION flag sql/sql_update.cc: 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())
Diffstat (limited to 'sql/sql_update.cc')
-rw-r--r--sql/sql_update.cc26
1 files changed, 26 insertions, 0 deletions
diff --git a/sql/sql_update.cc b/sql/sql_update.cc
index eb4e9b7ed73..f15db220a3b 100644
--- a/sql/sql_update.cc
+++ b/sql/sql_update.cc
@@ -1249,6 +1249,32 @@ multi_update::initialize_tables(JOIN *join)
}
}
+ /*
+ 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() &