summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
authorigor@olga.mysql.com <>2007-01-19 08:00:29 -0800
committerigor@olga.mysql.com <>2007-01-19 08:00:29 -0800
commitf346abb5ea5554ec5d41ec2ec460a016a94c5d8b (patch)
tree320e6d6667cc26ab681f629b878e61c6228bbafd /mysql-test
parentc1927e9a70f38a92a3164f71f4f7ff4449befcea (diff)
parent0d665bd545f96b9987b769011cd0f7097533aada (diff)
downloadmariadb-git-f346abb5ea5554ec5d41ec2ec460a016a94c5d8b.tar.gz
Merge olga.mysql.com:/home/igor/mysql-5.0-opt
into olga.mysql.com:/home/igor/dev-opt/mysql-5.0-opt-bug25580
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/r/udf.result34
-rw-r--r--mysql-test/t/udf.test47
2 files changed, 81 insertions, 0 deletions
diff --git a/mysql-test/r/udf.result b/mysql-test/r/udf.result
index 64b7111bbc8..d5f59247084 100644
--- a/mysql-test/r/udf.result
+++ b/mysql-test/r/udf.result
@@ -240,3 +240,37 @@ drop table bug18761;
select is_const((1,2,3));
ERROR 21000: Operand should contain 1 column(s)
drop function if exists is_const;
+CREATE FUNCTION metaphon RETURNS STRING SONAME "UDF_EXAMPLE_LIB";
+CREATE FUNCTION myfunc_double RETURNS REAL SONAME "UDF_EXAMPLE_LIB";
+CREATE FUNCTION myfunc_int RETURNS INTEGER SONAME "UDF_EXAMPLE_LIB";
+create function f1(p1 varchar(255))
+returns varchar(255)
+begin
+return metaphon(p1);
+end//
+create function f2(p1 varchar(255))
+returns double
+begin
+return myfunc_double(p1);
+end//
+create function f3(p1 varchar(255))
+returns double
+begin
+return myfunc_int(p1);
+end//
+select f3(NULL);
+f3(NULL)
+0
+select f2(NULL);
+f2(NULL)
+NULL
+select f1(NULL);
+f1(NULL)
+NULL
+drop function f1;
+drop function f2;
+drop function f3;
+drop function metaphon;
+drop function myfunc_double;
+drop function myfunc_int;
+End of 5.0 tests.
diff --git a/mysql-test/t/udf.test b/mysql-test/t/udf.test
index 65cbc7ae3ae..0b582dc61b6 100644
--- a/mysql-test/t/udf.test
+++ b/mysql-test/t/udf.test
@@ -242,3 +242,50 @@ drop table bug18761;
select is_const((1,2,3));
drop function if exists is_const;
+
+#
+# Bug #25382: Passing NULL to an UDF called from stored procedures
+# crashes server
+#
+--replace_result $UDF_EXAMPLE_LIB UDF_EXAMPLE_LIB
+eval CREATE FUNCTION metaphon RETURNS STRING SONAME "$UDF_EXAMPLE_LIB";
+
+--replace_result $UDF_EXAMPLE_LIB UDF_EXAMPLE_LIB
+eval CREATE FUNCTION myfunc_double RETURNS REAL SONAME "$UDF_EXAMPLE_LIB";
+
+--replace_result $UDF_EXAMPLE_LIB UDF_EXAMPLE_LIB
+eval CREATE FUNCTION myfunc_int RETURNS INTEGER SONAME "$UDF_EXAMPLE_LIB";
+
+delimiter //;
+create function f1(p1 varchar(255))
+returns varchar(255)
+begin
+ return metaphon(p1);
+end//
+
+create function f2(p1 varchar(255))
+returns double
+begin
+ return myfunc_double(p1);
+end//
+
+create function f3(p1 varchar(255))
+returns double
+begin
+ return myfunc_int(p1);
+end//
+
+delimiter ;//
+
+select f3(NULL);
+select f2(NULL);
+select f1(NULL);
+
+drop function f1;
+drop function f2;
+drop function f3;
+drop function metaphon;
+drop function myfunc_double;
+drop function myfunc_int;
+
+--echo End of 5.0 tests.