summaryrefslogtreecommitdiff
path: root/sql/table.cc
diff options
context:
space:
mode:
authorSergey Vojtovich <svoj@mariadb.org>2015-04-08 10:55:51 +0400
committerSergey Vojtovich <svoj@mariadb.org>2015-05-07 20:45:46 +0400
commit0fcc350f732af1a3f3cbc97abf341e1bdde0d3e2 (patch)
treea0b9a3573f6f26dffbc542e8e66798094c833c40 /sql/table.cc
parent3832bda1ba9f31294d57b565030ea3f5d35e6a82 (diff)
downloadmariadb-git-0fcc350f732af1a3f3cbc97abf341e1bdde0d3e2.tar.gz
MDEV-7922 - ERROR 1939 (HY000): Engine PERFORMANCE_SCHEMA failed to discover
table Performance schema discovery fails if connection has no active database set. This happened due to restriction in SQL parser: table name with no database name is ambiguous in such case. Fixed by temporary substitution of default database with being discovered table database.
Diffstat (limited to 'sql/table.cc')
-rw-r--r--sql/table.cc3
1 files changed, 3 insertions, 0 deletions
diff --git a/sql/table.cc b/sql/table.cc
index 5c85d5668ed..54a686197b0 100644
--- a/sql/table.cc
+++ b/sql/table.cc
@@ -2158,6 +2158,7 @@ int TABLE_SHARE::init_from_sql_statement_string(THD *thd, bool write,
uint unused2;
handlerton *hton= plugin_hton(db_plugin);
LEX_CUSTRING frm= {0,0};
+ LEX_STRING db_backup= { thd->db, thd->db_length };
DBUG_ENTER("TABLE_SHARE::init_from_sql_statement_string");
@@ -2185,6 +2186,7 @@ int TABLE_SHARE::init_from_sql_statement_string(THD *thd, bool write,
else
thd->set_n_backup_active_arena(arena, &backup);
+ thd->reset_db(db.str, db.length);
lex_start(thd);
if ((error= parse_sql(thd, & parser_state, NULL) ||
@@ -2213,6 +2215,7 @@ int TABLE_SHARE::init_from_sql_statement_string(THD *thd, bool write,
ret:
my_free(const_cast<uchar*>(frm.str));
lex_end(thd->lex);
+ thd->reset_db(db_backup.str, db_backup.length);
thd->lex= old_lex;
if (arena)
thd->restore_active_arena(arena, &backup);