From c8dbef22add27eb6cc737b12eb80b968663d34bb Mon Sep 17 00:00:00 2001 From: Oleksandr Byelkin Date: Sun, 12 Apr 2015 20:41:28 +1000 Subject: MDEV-6916 REPAIR VIEW / mysql migration from: r4407 --- sql/sql_base.cc | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'sql/sql_base.cc') diff --git a/sql/sql_base.cc b/sql/sql_base.cc index 3c36c2b514a..8be057eb08e 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -643,7 +643,8 @@ found: open_table_error(share, share->error, share->open_errno, share->errarg); DBUG_RETURN(0); } - if (share->is_view && !(db_flags & OPEN_VIEW)) + if ((share->is_view && !(db_flags & OPEN_VIEW)) || + (!share->is_view && (db_flags & OPEN_VIEW_ONLY))) { open_table_error(share, 1, ENOENT, 0); DBUG_RETURN(0); @@ -3022,12 +3023,17 @@ bool open_table(THD *thd, TABLE_LIST *table_list, MEM_ROOT *mem_root, else if (table_list->open_strategy == TABLE_LIST::OPEN_STUB) DBUG_RETURN(FALSE); + retry_share: mysql_mutex_lock(&LOCK_open); if (!(share= get_table_share_with_discover(thd, table_list, key, - key_length, OPEN_VIEW, + key_length, + (OPEN_VIEW | + ((table_list->required_type == + FRMTYPE_VIEW) ? + OPEN_VIEW_ONLY : 0)), &error, hash_value))) { -- cgit v1.2.1