summaryrefslogtreecommitdiff
path: root/sql/sql_base.cc
diff options
context:
space:
mode:
authorOleksandr Byelkin <sanja@askmonty.org>2015-04-12 20:41:28 +1000
committerDaniel Black <grooverdan@users.sourceforge.net>2015-04-12 20:41:28 +1000
commitc8dbef22add27eb6cc737b12eb80b968663d34bb (patch)
tree07bf65480972ccbf76bb058d92695da5de74e126 /sql/sql_base.cc
parente5191dd11beaec44230f97ec1402439ffd27333b (diff)
downloadmariadb-git-c8dbef22add27eb6cc737b12eb80b968663d34bb.tar.gz
MDEV-6916 REPAIR VIEW / mysql migration
from: r4407
Diffstat (limited to 'sql/sql_base.cc')
-rw-r--r--sql/sql_base.cc10
1 files changed, 8 insertions, 2 deletions
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)))
{