summaryrefslogtreecommitdiff
path: root/sql/item_sum.cc
diff options
context:
space:
mode:
authorSergei Golubchik <sergii@pisem.net>2013-02-28 18:42:49 +0100
committerSergei Golubchik <sergii@pisem.net>2013-02-28 18:42:49 +0100
commit8161c6772d144d6a4f08fc924ff6e6e403d1371d (patch)
tree3f1fe5f8048a163da4eadf0f86c1fd2a3007955d /sql/item_sum.cc
parent154aac8eb002f5d167153e09f1d13570989521e0 (diff)
parent31c06437c970d4d0f4ec0301acac9c56e0ed29b5 (diff)
downloadmariadb-git-8161c6772d144d6a4f08fc924ff6e6e403d1371d.tar.gz
merge with mysql-5.5.30 minus few incorrect or not applicable changesets
Diffstat (limited to 'sql/item_sum.cc')
-rw-r--r--sql/item_sum.cc15
1 files changed, 9 insertions, 6 deletions
diff --git a/sql/item_sum.cc b/sql/item_sum.cc
index 04358ac8c45..72e0e637d38 100644
--- a/sql/item_sum.cc
+++ b/sql/item_sum.cc
@@ -152,9 +152,10 @@ bool Item_sum::check_sum_func(THD *thd, Item **ref)
If it is there under a construct where it is not allowed
we report an error.
*/
- invalid= !(allow_sum_func & (1 << max_arg_level));
+ invalid= !(allow_sum_func & ((nesting_map)1 << max_arg_level));
}
- else if (max_arg_level >= 0 || !(allow_sum_func & (1 << nest_level)))
+ else if (max_arg_level >= 0 ||
+ !(allow_sum_func & ((nesting_map)1 << nest_level)))
{
/*
The set function can be aggregated only in outer subqueries.
@@ -163,7 +164,8 @@ bool Item_sum::check_sum_func(THD *thd, Item **ref)
*/
if (register_sum_func(thd, ref))
return TRUE;
- invalid= aggr_level < 0 && !(allow_sum_func & (1 << nest_level));
+ invalid= aggr_level < 0 &&
+ !(allow_sum_func & ((nesting_map)1 << nest_level));
if (!invalid && thd->variables.sql_mode & MODE_ANSI)
invalid= aggr_level < 0 && max_arg_level < nest_level;
}
@@ -311,14 +313,15 @@ bool Item_sum::register_sum_func(THD *thd, Item **ref)
sl && sl->nest_level > max_arg_level;
sl= sl->master_unit()->outer_select() )
{
- if (aggr_level < 0 && (allow_sum_func & (1 << sl->nest_level)))
+ if (aggr_level < 0 &&
+ (allow_sum_func & ((nesting_map)1 << sl->nest_level)))
{
/* Found the most nested subquery where the function can be aggregated */
aggr_level= sl->nest_level;
aggr_sel= sl;
}
}
- if (sl && (allow_sum_func & (1 << sl->nest_level)))
+ if (sl && (allow_sum_func & ((nesting_map)1 << sl->nest_level)))
{
/*
We reached the subquery of level max_arg_level and checked
@@ -559,7 +562,7 @@ void Item_sum::update_used_tables ()
used_tables_cache&= PSEUDO_TABLE_BITS;
// the aggregate function is aggregated into its local context
- used_tables_cache |= (1 << aggr_sel->join->table_count) - 1;
+ used_tables_cache|= ((table_map)1 << aggr_sel->join->tables) - 1;
} because if we do it, table elimination will assume that
- constructs like "COUNT(*)" use columns from all tables