Bug #24755 UDFs can't use builtin functions as parameters
Submitted: 1 Dec 2006 14:51 Modified: 1 Dec 2006 15:22
Reporter: Chad MILLER Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Server: User-defined functions ( UDF ) Severity:S1 (Critical)
Version:5.1 OS:
Assigned to: Marc ALFF CPU Architecture:Any
Tags: udf

[1 Dec 2006 14:51] Chad MILLER
Description:
This fails only recently in 5.1.  Figuratively,

select udf(builtin());

Tagged showstopper because it's a regression in functionality.

How to repeat:
===== mysql-test/r/udf.result 1.9 vs edited =====
--- 1.9/mysql-test/r/udf.result 2006-12-01 09:43:22 -05:00
+++ edited/mysql-test/r/udf.result      2006-12-01 09:43:14 -05:00
@@ -106,6 +106,15 @@ id select_type     table   type    possible_keys
 1      SIMPLE  t1      ALL     NULL    NULL    NULL    NULL    2       Using temporary; Using filesort
 drop table t1;
 End of 5.0 tests.
+select myfunc_double(acos(0));
+myfunc_double(acos(0))
+52.87
+select myfunc_double(myfunc_double(acos(0)));
+myfunc_double(myfunc_double(acos(0)))
+52.00
+select myfunc_double(myfunc_double(myfunc_double(acos(0))));
+myfunc_double(myfunc_double(myfunc_double(acos(0))))
+49.00
 DROP FUNCTION metaphon;
 DROP FUNCTION myfunc_double;
 DROP FUNCTION myfunc_nonexist;
===== mysql-test/t/udf.test 1.10 vs edited =====
--- 1.10/mysql-test/t/udf.test  2006-12-01 09:43:23 -05:00
+++ edited/mysql-test/t/udf.test        2006-12-01 09:43:01 -05:00
@@ -129,6 +129,15 @@ explain select myfunc_int(f1) from t1 or
 drop table t1;
 --echo End of 5.0 tests.
 
+
+#
+# Bug#nnnn: UDFs can't use builtin functions as parameters
+#
+select myfunc_double(acos(0));
+select myfunc_double(myfunc_double(acos(0)));
+select myfunc_double(myfunc_double(myfunc_double(acos(0))));
+
+
 #
 # Drop the example functions from udf_example
 #

Suggested fix:
According to Marc Alff,

"""In 5.1, the udf_list.push() and pop() are not balanced.  The push is always done, the pop is done only if the function is not a built-in.  So it's a merge issue from 5.0 -> 5.1.

I think udf_list has other issues."""
[1 Dec 2006 15:22] Marc ALFF
Closed as duplicate of Bug#24736