diff options
author | Jon Olav Hauglid <jon.hauglid@sun.com> | 2009-12-10 13:02:37 +0100 |
---|---|---|
committer | Jon Olav Hauglid <jon.hauglid@sun.com> | 2009-12-10 13:02:37 +0100 |
commit | 0b874e3e09570250acd00e355bfb92c77dbd3ca5 (patch) | |
tree | c7882ec1d412110aa5f5f278c9d7d39720d0a95e /sql/sql_view.cc | |
parent | 84e35f5e1c627a7129b3a4d79140219de81acb1e (diff) | |
download | mariadb-git-0b874e3e09570250acd00e355bfb92c77dbd3ca5.tar.gz |
Backport of revno: 2617.68.43
Bug #47335 assert in get_table_share
The assert would happen if ALTER VIEW was used to alter a view (existing
or non-existing) and a temporary table with the same name already existed.
The assert is triggered if the current statement does not have a MDL lock on
the view to be altered. This would happen because open_table() would open
the temporary table instead and MDL locks are not taken for temporary
tables (since they are local to one connection).
The patch changes open_type for CREATE/ALTER VIEW to OT_BASE_ONLY. This prevents
open_table() from trying to open a temporary table with the same name should
one exist. Now the view will be altered if it exists or ER_NO_SUCH_TABLE will
be reported if it does not.
Test case added to view.test
Diffstat (limited to 'sql/sql_view.cc')
-rw-r--r-- | sql/sql_view.cc | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/sql/sql_view.cc b/sql/sql_view.cc index 0f920bca101..6d2836afc0d 100644 --- a/sql/sql_view.cc +++ b/sql/sql_view.cc @@ -397,6 +397,7 @@ bool mysql_create_view(THD *thd, TABLE_LIST *views, lex->link_first_table_back(view, link_to_local); view->open_strategy= TABLE_LIST::OPEN_STUB; view->lock_strategy= TABLE_LIST::EXCLUSIVE_MDL; + view->open_type= OT_BASE_ONLY; if (open_and_lock_tables(thd, lex->query_tables)) { |