From: Date: September 20 2005 9:33am Subject: bk commit into 4.1 tree (ramil:1.2446) BUG#11553 List-Archive: http://lists.mysql.com/internals/30086 X-Bug: 11553 Message-Id: <200509200733.j8K7XLHv056289@gw.mysql.r18.ru> Below is the list of changes that have just been committed into a local 4.1 repository of ram. When ram does a push these changes will be propagated to the main repository and, within 24 hours after the push, to the public repository. For information on how to access the public repository see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html ChangeSet 1.2446 05/09/20 12:33:12 ramil@stripped +1 -0 a fix (bug #11553: gives error if aggregate user-defined function in HAVING clause). sql/sql_yacc.yy 1.393 05/09/20 12:33:04 ramil@stripped +20 -4 a fix (bug #11553: gives error if aggregate user-defined function in HAVING clause). udf_sum_expr_list rule introduced and used for aggregate udf functions: - call inc_in_sum_expr() before udf_expr_list parsing (as in_sum_expr rule does). # This is a BitKeeper patch. What follows are the unified diffs for the # set of deltas contained in the patch. The rest of the patch, the part # that BitKeeper cares about, is below these diffs. # User: ramil # Host: gw.mysql.r18.ru # Root: /usr/home/ram/work/4.1.b11553 --- 1.392/sql/sql_yacc.yy 2005-09-14 17:31:33 +05:00 +++ 1.393/sql/sql_yacc.yy 2005-09-20 12:33:04 +05:00 @@ -644,7 +644,8 @@ NUM_literal %type - expr_list udf_expr_list when_list ident_list ident_list_arg + expr_list udf_expr_list udf_sum_expr_list when_list ident_list + ident_list_arg %type key_type opt_unique_or_fulltext constraint_key_type @@ -3137,21 +3138,21 @@ { $$= new Item_func_trim($5,$3); } | TRUNCATE_SYM '(' expr ',' expr ')' { $$= new Item_func_round($3,$5,1); } - | UDA_CHAR_SUM '(' udf_expr_list ')' + | UDA_CHAR_SUM '(' udf_sum_expr_list ')' { if ($3 != NULL) $$ = new Item_sum_udf_str($1, *$3); else $$ = new Item_sum_udf_str($1); } - | UDA_FLOAT_SUM '(' udf_expr_list ')' + | UDA_FLOAT_SUM '(' udf_sum_expr_list ')' { if ($3 != NULL) $$ = new Item_sum_udf_float($1, *$3); else $$ = new Item_sum_udf_float($1); } - | UDA_INT_SUM '(' udf_expr_list ')' + | UDA_INT_SUM '(' udf_sum_expr_list ')' { if ($3 != NULL) $$ = new Item_sum_udf_int($1, *$3); @@ -3288,6 +3289,21 @@ udf_expr_list: /* empty */ { $$= NULL; } | expr_list { $$= $1;}; + +udf_sum_expr_list: + { + LEX *lex= Lex; + if (lex->current_select->inc_in_sum_expr()) + { + yyerror(ER(ER_SYNTAX_ERROR)); + YYABORT; + } + } + udf_expr_list + { + Select->in_sum_expr--; + $$= $2; + }; sum_expr: AVG_SYM '(' in_sum_expr ')'