summaryrefslogtreecommitdiff
path: root/sql/sql_view.cc
diff options
context:
space:
mode:
authorOleksandr Byelkin <sanja@mariadb.com>2019-10-17 14:08:33 +0200
committerOleksandr Byelkin <sanja@mariadb.com>2019-10-17 17:32:14 +0200
commitde2186dd2f5937a56d799f55c33078a7ad8ebddc (patch)
tree7b44a00f8fb8dcbea6145a0ae2fecf0cc764ac72 /sql/sql_view.cc
parent6cdde9ebbf59254a81f04961818577ffd203f9d6 (diff)
downloadmariadb-git-de2186dd2f5937a56d799f55c33078a7ad8ebddc.tar.gz
MDEV-20074: Lost connection on update trigger
Instead of checking lex->sql_command which does not corect in case of triggers mark tables for insert.
Diffstat (limited to 'sql/sql_view.cc')
-rw-r--r--sql/sql_view.cc13
1 files changed, 13 insertions, 0 deletions
diff --git a/sql/sql_view.cc b/sql/sql_view.cc
index 0bde411a977..98c1e816f31 100644
--- a/sql/sql_view.cc
+++ b/sql/sql_view.cc
@@ -1490,6 +1490,7 @@ bool mysql_make_view(THD *thd, TABLE_SHARE *share, TABLE_LIST *table,
privileges of top_view
*/
tbl->grant.want_privilege= SELECT_ACL;
+
/*
After unfolding the view we lose the list of tables referenced in it
(we will have only a list of underlying tables in case of MERGE
@@ -1540,6 +1541,18 @@ bool mysql_make_view(THD *thd, TABLE_SHARE *share, TABLE_LIST *table,
views with subqueries in select list.
*/
view_main_select_tables= lex->select_lex.table_list.first;
+ /*
+ Mergeable view can be used for inserting, so we move the flag down
+ */
+ if (table->for_insert_data)
+ {
+ for (TABLE_LIST *t= view_main_select_tables;
+ t;
+ t= t->next_local)
+ {
+ t->for_insert_data= TRUE;
+ }
+ }
/*
Let us set proper lock type for tables of the view's main