diff options
author | unknown <gkodinov/kgeorge@macbook.gmz> | 2006-09-27 13:03:41 +0300 |
---|---|---|
committer | unknown <gkodinov/kgeorge@macbook.gmz> | 2006-09-27 13:03:41 +0300 |
commit | c689d424fd044a4fdaf708387e6869f7de9e8780 (patch) | |
tree | 65907e2a768f8c8264d23443578b32087e11b8f4 /sql/item_sum.cc | |
parent | d752b1a8da85f1d0ddc5b5e3e5bbe056e0e647e6 (diff) | |
parent | ca5e29475c8ae52035214c710be04bcb1ed13177 (diff) | |
download | mariadb-git-c689d424fd044a4fdaf708387e6869f7de9e8780.tar.gz |
Merge macbook.gmz:/Users/kgeorge/mysql/work/B21174-5.0-opt
into macbook.gmz:/Users/kgeorge/mysql/work/B21174-5.1-opt
mysql-test/r/ctype_ucs.result:
Auto merged
mysql-test/r/func_gconcat.result:
Auto merged
mysql-test/r/func_group.result:
Auto merged
mysql-test/r/group_by.result:
Auto merged
mysql-test/r/subselect.result:
Auto merged
mysql-test/r/view.result:
Auto merged
mysql-test/t/ctype_ucs.test:
Auto merged
mysql-test/t/func_gconcat.test:
Auto merged
mysql-test/t/ps.test:
Auto merged
mysql-test/t/view.test:
Auto merged
sql/field.h:
Auto merged
sql/filesort.cc:
Auto merged
sql/item.cc:
Auto merged
sql/item_sum.cc:
Auto merged
sql/mysql_priv.h:
Auto merged
sql/sql_lex.cc:
Auto merged
sql/sql_select.cc:
Auto merged
sql/sql_yacc.yy:
Auto merged
storage/myisam/mi_check.c:
Auto merged
mysql-test/r/ps.result:
merge 5.0-opt -> 5.1-opt
sql/unireg.cc:
merge 5.0-opt -> 5.1-opt
Diffstat (limited to 'sql/item_sum.cc')
-rw-r--r-- | sql/item_sum.cc | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/sql/item_sum.cc b/sql/item_sum.cc index cf122f565ff..73e2c5e6935 100644 --- a/sql/item_sum.cc +++ b/sql/item_sum.cc @@ -246,7 +246,27 @@ bool Item_sum::register_sum_func(THD *thd, Item **ref) aggr_sl->inner_sum_func_list->next= this; } aggr_sl->inner_sum_func_list= this; - + aggr_sl->with_sum_func= 1; + + /* + Mark Item_subselect(s) as containing aggregate function all the way up + to aggregate function's calculation context. + Note that we must not mark the Item of calculation context itself + because with_sum_func on the calculation context st_select_lex is + already set above. + + with_sum_func being set for an Item means that this Item refers + (somewhere in it, e.g. one of its arguments if it's a function) directly + or through intermediate items to an aggregate function that is calculated + in a context "outside" of the Item (e.g. in the current or outer select). + + with_sum_func being set for an st_select_lex means that this st_select_lex + has aggregate functions directly referenced (i.e. not through a sub-select). + */ + for (sl= thd->lex->current_select; + sl && sl != aggr_sl && sl->master_unit()->item; + sl= sl->master_unit()->outer_select() ) + sl->master_unit()->item->with_sum_func= 1; } return FALSE; } |