mirror of
https://github.com/MariaDB/server.git
synced 2025-01-16 03:52:35 +01:00
Bug #15948123: SERVER WORKS INCORRECT WITH LONG TABLE ALIASES
Code in MDL subsystem assumes that identifiers of objects can't be longer than NAME_LEN characters. This assumption was broken when one tried to construct MDL_key based on table alias, which can have arbitrary length. Since MDL_key's (and MDL locks) are not really used for table aliases this patch changes code to not initialize MDL_key object for table list element representing aliases.
This commit is contained in:
parent
195e731edb
commit
70cb820e2d
2 changed files with 9 additions and 2 deletions
|
@ -246,6 +246,8 @@ public:
|
|||
}
|
||||
void mdl_key_init(const MDL_key *rhs)
|
||||
{
|
||||
DBUG_ASSERT(rhs->m_length <= NAME_LEN);
|
||||
DBUG_ASSERT(rhs->m_db_name_length <= NAME_LEN);
|
||||
memcpy(m_ptr, rhs->m_ptr, rhs->m_length);
|
||||
m_length= rhs->m_length;
|
||||
m_db_name_length= rhs->m_db_name_length;
|
||||
|
|
|
@ -6000,8 +6000,13 @@ TABLE_LIST *st_select_lex::add_table_to_list(THD *thd,
|
|||
ptr->next_name_resolution_table= NULL;
|
||||
/* Link table in global list (all used tables) */
|
||||
lex->add_to_query_tables(ptr);
|
||||
ptr->mdl_request.init(MDL_key::TABLE, ptr->db, ptr->table_name, mdl_type,
|
||||
MDL_TRANSACTION);
|
||||
|
||||
// Pure table aliases do not need to be locked:
|
||||
if (!test(table_options & TL_OPTION_ALIAS))
|
||||
{
|
||||
ptr->mdl_request.init(MDL_key::TABLE, ptr->db, ptr->table_name, mdl_type,
|
||||
MDL_TRANSACTION);
|
||||
}
|
||||
DBUG_RETURN(ptr);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue