summaryrefslogtreecommitdiff
path: root/sql/sql_view.cc
diff options
context:
space:
mode:
authorOleksandr Byelkin <sanja@mariadb.com>2017-01-04 13:26:09 +0100
committerOleksandr Byelkin <sanja@mariadb.com>2017-01-04 13:27:45 +0100
commitbc4cac358ed0d08daaa3cb869b3ecc444afa09fa (patch)
treeaf059e932b6ab8dd758e8dae6920b9b23b74d3e1 /sql/sql_view.cc
parent80d5d1452a4a6b7bd1627116f2a5a950003fc3cb (diff)
downloadmariadb-git-bc4cac358ed0d08daaa3cb869b3ecc444afa09fa.tar.gz
MDEV-10035: DBUG_ASSERT on CREATE VIEW v1 AS SELECT * FROM t1 FOR UPDATE
Ability to print lock type added. Restoring correct lock type for CREATE VIEW added.
Diffstat (limited to 'sql/sql_view.cc')
-rw-r--r--sql/sql_view.cc9
1 files changed, 9 insertions, 0 deletions
diff --git a/sql/sql_view.cc b/sql/sql_view.cc
index f3717e3ded2..9fe4dd4849d 100644
--- a/sql/sql_view.cc
+++ b/sql/sql_view.cc
@@ -430,6 +430,15 @@ bool mysql_create_view(THD *thd, TABLE_LIST *views,
lex->link_first_table_back(view, link_to_local);
view->open_type= OT_BASE_ONLY;
+ /*
+ ignore lock specs for CREATE statement
+ */
+ if (lex->current_select->lock_type != TL_READ_DEFAULT)
+ {
+ lex->current_select->set_lock_for_tables(TL_READ_DEFAULT);
+ view->mdl_request.set_type(MDL_EXCLUSIVE);
+ }
+
if (open_temporary_tables(thd, lex->query_tables) ||
open_and_lock_tables(thd, lex->query_tables, TRUE, 0))
{