Details
-
Bug
-
Status: Open (View Workflow)
-
Major
-
Resolution: Unresolved
-
10.3(EOL), 10.11, 11.4, 11.8, 12.3
-
None
-
None
Description
Apply the following diff to the test and observe constant results:
diff --git a/mysql-test/suite/vcol/t/query_cache.test b/mysql-test/suite/vcol/t/query_cache.test
|
index 46bcba7d03f..d71cfc70d74 100644
|
--- a/mysql-test/suite/vcol/t/query_cache.test
|
+++ b/mysql-test/suite/vcol/t/query_cache.test
|
@@ -7,9 +7,16 @@ set query_cache_type=1;
|
set rand_seed1=1234567890, rand_seed2=20;
|
create table t1 (a int, b float as (rand()));
|
insert into t1 (a) values (1);
|
+disable_query_log;
|
+flush tables;
|
+enable_query_log;
|
--disable_ps2_protocol
|
select * from t1;
|
select * from t1;
|
+select * from t1;
|
+select * from t1;
|
+select * from t1;
|
+select * from t1;
|
set global query_cache_type=default;
|
select * from t1;
|
--enable_ps2_protocol
|
Result diff:
CURRENT_TEST: vcol.query_cache
|
--- mysql-test/suite/vcol/r/query_cache.result 2026-06-16 23:59:34.534628154 +0400
|
+++ mysql-test/suite/vcol/r/query_cache.reject 2026-10-15 21:22:15.252370091 +0400
|
@@ -11,10 +11,22 @@
|
1 0.449343
|
select * from t1;
|
a b
|
-1 0.797372
|
+1 0.449343
|
+select * from t1;
|
+a b
|
+1 0.449343
|
+select * from t1;
|
+a b
|
+1 0.449343
|
+select * from t1;
|
+a b
|
+1 0.449343
|
+select * from t1;
|
+a b
|
+1 0.449343
|
set global query_cache_type=default;
|
select * from t1;
|
a b
|
-1 0.638829
|
+1 0.797372
|
drop table t1;
|
# End of 10.11 tests
|
Codex explanation:
After FLUSH TABLES, opening a table with a RAND() virtual column fixes the expression under a temporary LEX. RAND() clears safe_to_cache_query there, but the flag is not propagated to the SELECT's LEX. The additional fix is skipped for newly opened TABLE instances (from_share=true).
With query cache enabled, the SELECT is therefore cached, and subsequent identical queries reuse the random value. The fix for MDEV-29186 does not cover this path.
Note: other functions like AI_EMBED() can also be affected.
Attachments
Issue Links
- relates to
-
MDEV-36100 Generate vector embeddings automatically on INSERT
-
- In Progress
-
-
MDEV-41568 SQL_CACHE overrides the cache prohibition for RAND() and similar functions
-
- Open
-
-
MDEV-29186 Query cache makes virtual column function RAND() non-random
-
- Closed
-