mirror of
https://github.com/MariaDB/server.git
synced 2025-08-08 11:22:35 +03:00
Bug #11758687: 50924: object names not resolved correctly
on lctn2 systems There was a local variable in get_all_tables() to store the "original" value of the database name as it can get lowercased depending on the lower_case_table_name value. get_all_tables() iterates over database names and for each database iterates over the tables in it. The "original" db name was assigned in the table names loop. Thus the first table is ok, but the second and subsequent tables get the lowercased name from processing the first table. Fixed by moving the assignment of the original database name from the inner (table name) to the outer (database name) loop. Test suite added.
This commit is contained in:
@@ -3399,6 +3399,12 @@ int get_all_tables(THD *thd, TABLE_LIST *tables, COND *cond)
|
||||
it.rewind(); /* To get access to new elements in basis list */
|
||||
while ((db_name= it++))
|
||||
{
|
||||
LEX_STRING orig_db_name;
|
||||
|
||||
/* db_name can be changed in make_table_list() func */
|
||||
if (!thd->make_lex_string(&orig_db_name, db_name->str,
|
||||
db_name->length, FALSE))
|
||||
goto err;
|
||||
#ifndef NO_EMBEDDED_ACCESS_CHECKS
|
||||
if (!(check_access(thd,SELECT_ACL, db_name->str,
|
||||
&thd->col_access, 0, 1, with_i_schema) ||
|
||||
@@ -3461,17 +3467,13 @@ int get_all_tables(THD *thd, TABLE_LIST *tables, COND *cond)
|
||||
}
|
||||
|
||||
int res;
|
||||
LEX_STRING tmp_lex_string, orig_db_name;
|
||||
LEX_STRING tmp_lex_string;
|
||||
/*
|
||||
Set the parent lex of 'sel' because it is needed by
|
||||
sel.init_query() which is called inside make_table_list.
|
||||
*/
|
||||
thd->no_warnings_for_error= 1;
|
||||
sel.parent_lex= lex;
|
||||
/* db_name can be changed in make_table_list() func */
|
||||
if (!thd->make_lex_string(&orig_db_name, db_name->str,
|
||||
db_name->length, FALSE))
|
||||
goto err;
|
||||
if (make_table_list(thd, &sel, db_name, table_name))
|
||||
goto err;
|
||||
TABLE_LIST *show_table_list= sel.table_list.first;
|
||||
|
Reference in New Issue
Block a user