Below is the list of changes that have just been committed into a local
5.0 repository of pem. When pem 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.2046 06/02/09 13:00:32 pem@stripped +5 -0
Fixed BUG#16896: Stored function: unused AGGREGATE-clause in CREATE FUNCTION
Check if AGGREGATE was given with a stored (non-UDF) function, and return
error in that case.
Also made udf_example/udf_test work again, by adding a missing *_init()
function. (_init() functions required unless --allow_suspicious_udfs is
given to the server, since March 2005 - it seems udf_example wasn't updated
at the time.)
sql/udf_example.cc
1.19 06/02/09 13:00:28 pem@stripped +9 -0
Added myfunc_int_init() function to make it work when the server is running without
--allow_suspicious_udfs.
sql/sql_yacc.yy
1.453 06/02/09 13:00:28 pem@stripped +10 -0
Check if AGGREGATE was used when creating a stored function (i.e. not an UDF).
sql/share/errmsg.txt
1.59 06/02/09 13:00:28 pem@stripped +2 -0
New error message: ER_SP_NO_AGGREGATE
mysql-test/t/sp-error.test
1.104 06/02/09 13:00:28 pem@stripped +12 -0
Added test case for BUG#16896.
mysql-test/r/sp-error.result
1.103 06/02/09 13:00:28 pem@stripped +3 -0
Updated results for BUG#16896.
# 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: pem
# Host: pem.mysql.com
# Root: /extern/mysql/5.0/bug16896/mysql-5.0
--- 1.452/sql/sql_yacc.yy 2006-02-06 14:09:08 +01:00
+++ 1.453/sql/sql_yacc.yy 2006-02-09 13:00:28 +01:00
@@ -1326,6 +1326,16 @@
LEX *lex= Lex;
sp_head *sp;
+ /*
+ First check if AGGREGATE was used, in that case it's a
+ syntax error.
+ */
+ if (lex->udf.type == UDFTYPE_AGGREGATE)
+ {
+ my_error(ER_SP_NO_AGGREGATE, MYF(0));
+ YYABORT;
+ }
+
if (lex->sphead)
{
my_error(ER_SP_NO_RECURSIVE_CREATE, MYF(0), "FUNCTION");
--- 1.18/sql/udf_example.cc 2004-12-21 11:37:40 +01:00
+++ 1.19/sql/udf_example.cc 2006-02-09 13:00:28 +01:00
@@ -144,6 +144,7 @@
my_bool myfunc_double_init(UDF_INIT *, UDF_ARGS *args, char *message);
double myfunc_double(UDF_INIT *initid, UDF_ARGS *args, char *is_null,
char *error);
+my_bool myfunc_int_init(UDF_INIT *initid, UDF_ARGS *args, char *message);
longlong myfunc_int(UDF_INIT *initid, UDF_ARGS *args, char *is_null,
char *error);
my_bool sequence_init(UDF_INIT *initid, UDF_ARGS *args, char *message);
@@ -597,6 +598,14 @@
return val;
}
+/*
+ At least one of _init/_deinit is needed unless the server is started
+ with --allow_suspicious_udfs.
+*/
+my_bool myfunc_int_init(UDF_INIT *initid, UDF_ARGS *args, char *message)
+{
+ return 0;
+}
/*
Simple example of how to get a sequences starting from the first argument
--- 1.58/sql/share/errmsg.txt 2006-01-19 11:48:02 +01:00
+++ 1.59/sql/share/errmsg.txt 2006-02-09 13:00:28 +01:00
@@ -5607,3 +5607,5 @@
eng "Failed to load routine %s. The table mysql.proc is missing, corrupt, or contains bad data (internal code %d)"
ER_SP_WRONG_NAME 42000
eng "Incorrect routine name '%-.64s'"
+ER_SP_NO_AGGREGATE 42000
+ eng "AGGREGATE is not supported for stored functions"
--- 1.102/mysql-test/r/sp-error.result 2006-01-31 17:00:34 +01:00
+++ 1.103/mysql-test/r/sp-error.result 2006-02-09 13:00:28 +01:00
@@ -1176,3 +1176,6 @@
call bug15091();
ERROR 42S02: Unknown table 'c' in field list
drop procedure bug15091;
+drop function if exists bug16896;
+create aggregate function bug16896() returns int return 1;
+ERROR 42000: AGGREGATE is not supported for stored functions
--- 1.103/mysql-test/t/sp-error.test 2006-01-31 17:00:35 +01:00
+++ 1.104/mysql-test/t/sp-error.test 2006-02-09 13:00:28 +01:00
@@ -1704,9 +1704,21 @@
#
+# BUG#16896: Stored function: unused AGGREGATE-clause in CREATE FUNCTION
+#
+--disable_warnings
+drop function if exists bug16896;
+--enable_warnings
+
+--error ER_SP_NO_AGGREGATE
+create aggregate function bug16896() returns int return 1;
+
+
+#
# BUG#NNNN: New bug synopsis
#
#--disable_warnings
#drop procedure if exists bugNNNN|
#--enable_warnings
#create procedure bugNNNN...
+
| Thread |
|---|
| • bk commit into 5.0 tree (pem:1.2046) BUG#16896 | pem | 9 Feb |