1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

Merge branch '10.0' into 10.1

This commit is contained in:
Sergei Golubchik
2015-11-19 15:52:14 +01:00
186 changed files with 2827 additions and 965 deletions

View File

@ -6455,6 +6455,7 @@ find_field_in_table_ref(THD *thd, TABLE_LIST *table_list,
*/
table_name && table_name[0] &&
(my_strcasecmp(table_alias_charset, table_list->alias, table_name) ||
(db_name && db_name[0] && (!table_list->db || !table_list->db[0])) ||
(db_name && db_name[0] && table_list->db && table_list->db[0] &&
(table_list->schema_table ?
my_strcasecmp(system_charset_info, db_name, table_list->db) :
@ -6928,7 +6929,10 @@ find_item_in_list(Item *find, List<Item> &items, uint *counter,
for (uint i= 0; (item=li++); i++)
{
if (field_name && item->real_item()->type() == Item::FIELD_ITEM)
if (field_name &&
(item->real_item()->type() == Item::FIELD_ITEM ||
((item->type() == Item::REF_ITEM) &&
(((Item_ref *)item)->ref_type() == Item_ref::VIEW_REF))))
{
Item_ident *item_field= (Item_ident*) item;
@ -7054,35 +7058,6 @@ find_item_in_list(Item *find, List<Item> &items, uint *counter,
break;
}
}
else if (table_name && item->type() == Item::REF_ITEM &&
((Item_ref *)item)->ref_type() == Item_ref::VIEW_REF)
{
/*
TODO:Here we process prefixed view references only. What we should
really do is process all types of Item_ref's. But this will currently
lead to a clash with the way references to outer SELECTs (from the
HAVING clause) are handled in e.g. :
SELECT 1 FROM t1 AS t1_o GROUP BY a
HAVING (SELECT t1_o.a FROM t1 AS t1_i GROUP BY t1_i.a LIMIT 1).
Processing all Item_ref's here will cause t1_o.a to resolve to itself.
We still need to process the special case of Item_direct_view_ref
because in the context of views they have the same meaning as
Item_field for tables.
*/
Item_ident *item_ref= (Item_ident *) item;
if (field_name && item_ref->name && item_ref->table_name &&
!my_strcasecmp(system_charset_info, item_ref->name, field_name) &&
!my_strcasecmp(table_alias_charset, item_ref->table_name,
table_name) &&
(!db_name || (item_ref->db_name &&
!strcmp (item_ref->db_name, db_name))))
{
found= li.ref();
*counter= i;
*resolution= RESOLVED_IGNORING_ALIAS;
break;
}
}
}
if (!found)
{