Commit 5941479e authored by unknown's avatar unknown

Bug #28921 Queries containing UDF functions are cached

Fixed runtime to no longer allow the caching of queries with UDF calls.


mysql-test/r/udf.result:
  Added a test that turns on caching and checks that querys calling UDFs don't get cached.
mysql-test/t/udf.test:
  Added a test that turns on caching and checks that querys calling UDFs don't get cached.
sql/sql_yacc.yy:
  Fixed code to set safe_to_cache_query=0 regardless if the function call is a UDF or SP. Where it was placed previously -- at the very end of the else testing for UDFs -- it only executed the statement if the function call was a stored procedure call.
parent 1919b308
......@@ -273,4 +273,27 @@ drop function f3;
drop function metaphon;
drop function myfunc_double;
drop function myfunc_int;
CREATE FUNCTION metaphon RETURNS STRING SONAME "UDF_EXAMPLE_LIB";
create table t1 (a char);
set GLOBAL query_cache_size=1355776;
reset query cache;
select metaphon('MySQL') from t1;
metaphon('MySQL')
show status like "Qcache_hits";
Variable_name Value
Qcache_hits 0
show status like "Qcache_queries_in_cache";
Variable_name Value
Qcache_queries_in_cache 0
select metaphon('MySQL') from t1;
metaphon('MySQL')
show status like "Qcache_hits";
Variable_name Value
Qcache_hits 0
show status like "Qcache_queries_in_cache";
Variable_name Value
Qcache_queries_in_cache 0
drop table t1;
drop function metaphon;
set GLOBAL query_cache_size=default;
End of 5.0 tests.
......@@ -288,4 +288,28 @@ drop function metaphon;
drop function myfunc_double;
drop function myfunc_int;
#
# Bug #28921: Queries containing UDF functions are cached
#
--replace_result $UDF_EXAMPLE_LIB UDF_EXAMPLE_LIB
eval CREATE FUNCTION metaphon RETURNS STRING SONAME "$UDF_EXAMPLE_LIB";
create table t1 (a char);
set GLOBAL query_cache_size=1355776;
reset query cache;
select metaphon('MySQL') from t1;
show status like "Qcache_hits";
show status like "Qcache_queries_in_cache";
select metaphon('MySQL') from t1;
show status like "Qcache_hits";
show status like "Qcache_queries_in_cache";
drop table t1;
drop function metaphon;
set GLOBAL query_cache_size=default;
--echo End of 5.0 tests.
......@@ -5150,8 +5150,8 @@ simple_expr:
$$= new Item_func_sp(Lex->current_context(), name, *$4);
else
$$= new Item_func_sp(Lex->current_context(), name);
lex->safe_to_cache_query=0;
}
lex->safe_to_cache_query=0;
}
| UNIQUE_USERS '(' text_literal ',' NUM ',' NUM ',' expr_list ')'
{
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment