Commit 3e0a6263 authored by unknown's avatar unknown
Browse files

Fix for bug #9796 "Query Cache caches queries with CURRENT_USER()

function".

We should not cache queries using CURRENT_USER() function as we do it
for some other functions, e.g. USER() function.


mysql-test/r/query_cache.result:
  Let us test that queries with CURRENT_USER() function are not cached.
mysql-test/t/query_cache.test:
  Let us test that queries with CURRENT_USER() function are not cached.
sql/item_create.cc:
  create_func_current_user():
    We should not cache queries which use CURRENT_USER() function.
parent c6bb2293
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -299,6 +299,8 @@ select UNIX_TIMESTAMP() from t1;
UNIX_TIMESTAMP()
select USER() from t1;
USER()
select CURRENT_USER() from t1;
CURRENT_USER()
select benchmark(1,1) from t1;
benchmark(1,1)
show status like "Qcache_queries_in_cache";
+1 −0
Original line number Diff line number Diff line
@@ -182,6 +182,7 @@ select LAST_INSERT_ID() from t1;
select RAND() from t1;
select UNIX_TIMESTAMP() from t1;
select USER() from t1;
select CURRENT_USER() from t1;
select benchmark(1,1) from t1;
show status like "Qcache_queries_in_cache";
#
+1 −0
Original line number Diff line number Diff line
@@ -297,6 +297,7 @@ Item *create_func_current_user()
  char buff[HOSTNAME_LENGTH+USERNAME_LENGTH+2];
  uint length;

  thd->safe_to_cache_query= 0;
  length= (uint) (strxmov(buff, thd->priv_user, "@", thd->priv_host, NullS) -
		  buff);
  return new Item_string(NullS, thd->memdup(buff, length), length);