diff options
author | unknown <kostja@bodhi.(none)> | 2007-11-01 00:31:57 +0300 |
---|---|---|
committer | unknown <kostja@bodhi.(none)> | 2007-11-01 00:31:57 +0300 |
commit | 189ec0e0af2ab7d50340f66285ffecc4f06586c6 (patch) | |
tree | bcaa91f1539817a06d3c4e08a7e7caf42e152c40 /mysql-test/t/udf.test | |
parent | c2dadab13649b036b910596382307ffeef2a1951 (diff) | |
download | mariadb-git-189ec0e0af2ab7d50340f66285ffecc4f06586c6.tar.gz |
A fix for Bug#32007 select udf_function() doesn't return an error if error
during udf initialization. The bug is spotted while working on Bug 12713.
If a user-defined function was used in a SELECT statement, and an
error would occur during UDF initialization, this error would not terminate
execution of the SELECT, but rather would be converted to a warning.
The fix is to use a stack buffer to store the message from udf_init instead
of private my_error() buffer.
mysql-test/r/udf.result:
Update the result to reflect the fix for Bug#32007 select udf_function()
doesn't return an error if error during udf initialization
mysql-test/t/udf.test:
Update the test to reflect the fix for Bug #32007 select udf_function()
doesn't return an error if error during udf initialization
sql/item_func.cc:
A fix for Bug#32007.
net.last_error buffer was used to store the temporary message from udf_init.
Then, when my_error() was called, net.last_error was not empty so
my_error() would conclude that there is already an error in the error stack,
and not "overwrite" it.
However, thd->net.report_error was not set, so the the
SELECT was not aborted.
The fix is to use a stack buffer instead of thd->net.last_error
to store the message from udf_init. The message will end up in
thd->net.last_error anyway after a call to my_error.
Diffstat (limited to 'mysql-test/t/udf.test')
-rw-r--r-- | mysql-test/t/udf.test | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/mysql-test/t/udf.test b/mysql-test/t/udf.test index 663dc08d72e..32cfca57546 100644 --- a/mysql-test/t/udf.test +++ b/mysql-test/t/udf.test @@ -35,20 +35,20 @@ eval CREATE FUNCTION reverse_lookup eval CREATE AGGREGATE FUNCTION avgcost RETURNS REAL SONAME "$UDF_EXAMPLE_LIB"; ---error 0 +--error ER_CANT_INITIALIZE_UDF select myfunc_double(); select myfunc_double(1); select myfunc_double(78654); --error 1305 select myfunc_nonexist(); select myfunc_int(); ---error 0 +--error ER_CANT_INITIALIZE_UDF select lookup(); select lookup("127.0.0.1"); ---error 0 +--error ER_CANT_INITIALIZE_UDF select lookup(127,0,0,1); select lookup("localhost"); ---error 0 +--error ER_CANT_INITIALIZE_UDF select reverse_lookup(); # These two functions should return "localhost", but it's @@ -59,9 +59,9 @@ select reverse_lookup(127,0,0,1); --enable_result_log select reverse_lookup("localhost"); ---error 0 +--error ER_CANT_INITIALIZE_UDF select avgcost(); ---error 0 +--error ER_CANT_INITIALIZE_UDF select avgcost(100,23.76); create table t1(sum int, price float(24)); insert into t1 values(100, 50.00), (100, 100.00); |