summaryrefslogtreecommitdiff
path: root/sql/sql_parse.cc
diff options
context:
space:
mode:
authorGleb Shchepa <gleb.shchepa@oracle.com>2012-12-05 16:53:33 +0400
committerGleb Shchepa <gleb.shchepa@oracle.com>2012-12-05 16:53:33 +0400
commit9c59f5a57327dc6b8cc557251963427357902737 (patch)
treedaaa220f642d071a134e6759f5581dd0e7c08506 /sql/sql_parse.cc
parent611b3c46d4136849ab795f489f9055fde57cfe4d (diff)
downloadmariadb-git-9c59f5a57327dc6b8cc557251963427357902737.tar.gz
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.
Diffstat (limited to 'sql/sql_parse.cc')
-rw-r--r--sql/sql_parse.cc9
1 files changed, 7 insertions, 2 deletions
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index 7bbcff4bc2b..534c4cee4c7 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -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);
}