This is another attempt to fix mdev-16473.
The previous correction of the patch for mdev-16473 did not work correctly for the databases whose names started with '*'. Added a test case with a database named "*".
This commit is contained in:
parent
377cd52064
commit
090febbb2d
@ -1511,4 +1511,15 @@ a a
|
||||
3 3
|
||||
1 1
|
||||
drop database db_mdev_16473;
|
||||
create database `*` ;
|
||||
create table `*`.t1 (a int);
|
||||
insert into `*`.t1 values (2), (7), (3), (1);
|
||||
use `*`;
|
||||
select * from t1;
|
||||
a
|
||||
2
|
||||
7
|
||||
3
|
||||
1
|
||||
drop database `*`;
|
||||
use test;
|
||||
|
@ -1056,4 +1056,11 @@ select * from cte, db_mdev_16473.t1 as t where cte.a=t.a;
|
||||
|
||||
drop database db_mdev_16473;
|
||||
|
||||
create database `*` ;
|
||||
create table `*`.t1 (a int);
|
||||
insert into `*`.t1 values (2), (7), (3), (1);
|
||||
use `*`;
|
||||
select * from t1;
|
||||
drop database `*`;
|
||||
|
||||
use test;
|
||||
|
@ -3331,7 +3331,7 @@ 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->db[0] == no_db[0])
|
||||
if (tables->no_default_db && !tables->is_fqtn)
|
||||
{
|
||||
my_message(ER_NO_DB_ERROR, ER(ER_NO_DB_ERROR), MYF(0));
|
||||
error= TRUE;
|
||||
|
@ -3959,7 +3959,10 @@ public:
|
||||
my_message(ER_NO_DB_ERROR, ER(ER_NO_DB_ERROR), MYF(0));
|
||||
return TRUE;
|
||||
}
|
||||
/* This will allow to throw an error later for non-CTE references */
|
||||
/*
|
||||
It does not matter what database name is set in this case
|
||||
because it will never be used after parser stage
|
||||
*/
|
||||
*p_db_length= strlen(no_db);
|
||||
*p_db= strmake(no_db, *p_db_length);
|
||||
}
|
||||
|
@ -139,7 +139,7 @@ static bool execute_show_status(THD *, TABLE_LIST *);
|
||||
static bool check_rename_table(THD *, TABLE_LIST *, TABLE_LIST *);
|
||||
|
||||
const char *any_db="*any*"; // Special symbol for check_access
|
||||
const char *no_db="*none*"; // Used when no default db is set
|
||||
const char *no_db="*"; // Used when no default db is set
|
||||
|
||||
const LEX_STRING command_name[257]={
|
||||
{ C_STRING_WITH_LEN("Sleep") }, //0
|
||||
@ -8188,6 +8188,7 @@ TABLE_LIST *st_select_lex::add_table_to_list(THD *thd,
|
||||
DBUG_RETURN(0);
|
||||
else
|
||||
ptr->is_fqtn= FALSE;
|
||||
ptr->no_default_db= !thd->db && !(lex->sphead && lex->sphead->m_name.str);
|
||||
|
||||
ptr->alias= alias_str;
|
||||
ptr->is_alias= alias ? TRUE : FALSE;
|
||||
|
@ -2095,7 +2095,8 @@ struct TABLE_LIST
|
||||
qualified name (<db_name>.<table_name>).
|
||||
*/
|
||||
bool is_fqtn;
|
||||
|
||||
/** TRUE if no default database is defined for the table name */
|
||||
bool no_default_db;
|
||||
/* TRUE <=> derived table should be filled right after optimization. */
|
||||
bool fill_me;
|
||||
/* TRUE <=> view/DT is merged. */
|
||||
|
Loading…
x
Reference in New Issue
Block a user