diff --git a/sql/lex_ident.h b/sql/lex_ident.h index e5b6bf3f970..f447942ad30 100644 --- a/sql/lex_ident.h +++ b/sql/lex_ident.h @@ -165,6 +165,7 @@ public: */ class Lex_ident_db: public Lex_ident_fs { +public: bool is_null() const { return length == 0 && str == NULL; @@ -174,7 +175,6 @@ class Lex_ident_db: public Lex_ident_fs { return length == 0 && str != NULL; } -public: static bool check_name(const LEX_CSTRING &str); static bool check_name_with_error(const LEX_CSTRING &str); public: diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index b18cf0a1076..85faa44c96b 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -8111,7 +8111,8 @@ TABLE_LIST *st_select_lex::add_table_to_list(THD *thd, DBUG_RETURN(0); else fqtn= FALSE; - bool info_schema= is_infoschema_db(&db); + bool info_schema= (db.is_null() || db.is_empty()) + ? false : is_infoschema_db(&db); if (!table->sel && info_schema && (table_options & TL_OPTION_UPDATING) && /* Special cases which are processed by commands itself */