summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordkatz@damien-katzs-computer.local <>2007-06-13 14:23:25 -0400
committerdkatz@damien-katzs-computer.local <>2007-06-13 14:23:25 -0400
commit1481bfc87bfd178a1fd5526bfdb5b86d4c41bb32 (patch)
tree40ae8cd14ebfab90c4b1fcdfa663fb60431fe971
parentda33797903f52468af35e8f2f50e1ae35164a10a (diff)
downloadmariadb-git-1481bfc87bfd178a1fd5526bfdb5b86d4c41bb32.tar.gz
Bug #28897 UUID() returns non-unique values when query cache is enabled
Removed the ability to cache queries containing "UUID()".
-rw-r--r--mysql-test/r/query_cache.result7
-rw-r--r--mysql-test/t/query_cache.test24
-rw-r--r--sql/item_create.cc1
3 files changed, 32 insertions, 0 deletions
diff --git a/mysql-test/r/query_cache.result b/mysql-test/r/query_cache.result
index 79471ee5c02..53a0977a16a 100644
--- a/mysql-test/r/query_cache.result
+++ b/mysql-test/r/query_cache.result
@@ -1405,7 +1405,14 @@ Only MyISAM tables support collections 1
Function MATCH ... AGAINST() is used to do a search 1
Full-text search in MySQL implements vector space model 1
drop function change_global;
+drop table t1;
set GLOBAL query_cache_type=default;
set GLOBAL query_cache_limit=default;
set GLOBAL query_cache_min_res_unit=default;
set GLOBAL query_cache_size= default;
+set GLOBAL query_cache_size=1000000;
+create table t1 (a char);
+insert into t1 values ('c');
+a
+drop table t1;
+set GLOBAL query_cache_size= default;
diff --git a/mysql-test/t/query_cache.test b/mysql-test/t/query_cache.test
index 1ef104f820b..342ef5b6990 100644
--- a/mysql-test/t/query_cache.test
+++ b/mysql-test/t/query_cache.test
@@ -965,9 +965,33 @@ delimiter ;|
select *, change_global() from t1;
drop function change_global;
+drop table t1;
+
set GLOBAL query_cache_type=default;
set GLOBAL query_cache_limit=default;
set GLOBAL query_cache_min_res_unit=default;
set GLOBAL query_cache_size= default;
+
+#
+# Bug #28897 UUID() returns non-unique values when query cache is enabled
+#
+
+set GLOBAL query_cache_size=1000000;
+
+create table t1 (a char);
+insert into t1 values ('c');
+
+let $q1= `select UUID(), a from t1`;
+let $q2= `select UUID(), a from t1`;
+
+# disabling the logging of the query because the UUIDs are different each run.
+--disable_query_log
+eval select a from t1 where "$q1" = "$q2";
+--enable_query_log
+
+drop table t1;
+
+set GLOBAL query_cache_size= default;
+
# End of 5.0 tests
diff --git a/sql/item_create.cc b/sql/item_create.cc
index c4008d36aae..42cbdc8c280 100644
--- a/sql/item_create.cc
+++ b/sql/item_create.cc
@@ -418,6 +418,7 @@ Item *create_func_unhex(Item* a)
Item *create_func_uuid(void)
{
+ current_thd->lex->safe_to_cache_query= 0;
return new Item_func_uuid();
}