summaryrefslogtreecommitdiff
path: root/sql/sql_base.cc
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2018-06-28 12:36:32 +0200
committerSergei Golubchik <serg@mariadb.org>2018-06-28 12:38:53 +0200
commit52a25d7b674464013b7749a366b0879929985a1e (patch)
tree03aee2320340856a879392629041811eb4d0b0ef /sql/sql_base.cc
parent090febbb2dedad764a4d9fdbc9216921dd27225f (diff)
downloadmariadb-git-52a25d7b674464013b7749a366b0879929985a1e.tar.gz
MDEV-16473 WITH statement throws 'no database selected' error
Different fix, just use NULL, not no_db,
Diffstat (limited to 'sql/sql_base.cc')
-rw-r--r--sql/sql_base.cc14
1 files changed, 6 insertions, 8 deletions
diff --git a/sql/sql_base.cc b/sql/sql_base.cc
index 9905400109e..32e42daf7c4 100644
--- a/sql/sql_base.cc
+++ b/sql/sql_base.cc
@@ -1531,6 +1531,12 @@ bool open_table(THD *thd, TABLE_LIST *table_list, Open_table_context *ot_ctx)
DBUG_RETURN(true);
}
+ if (!table_list->db)
+ {
+ my_error(ER_NO_DB_ERROR, MYF(0));
+ DBUG_RETURN(true);
+ }
+
key_length= get_table_def_key(table_list, &key);
/*
@@ -3330,14 +3336,6 @@ open_and_process_table(THD *thd, LEX *lex, TABLE_LIST *tables,
/*
Not a placeholder: must be a base/temporary table or a view. Let us open it.
*/
-
- if (tables->no_default_db && !tables->is_fqtn)
- {
- my_message(ER_NO_DB_ERROR, ER(ER_NO_DB_ERROR), MYF(0));
- error= TRUE;
- goto end;
- }
-
if (tables->table)
{
/*