Bug #2645 static table + subquery + rand() = bug
Submitted: 5 Feb 2004 0:25 Modified: 16 Mar 2004 12:34
Reporter: Oleksandr Byelkin
Status: Closed
Category:Server Severity:S2 (Serious)
Version:4.1 OS:
Assigned to: Bugs System Target Version:

[5 Feb 2004 0:25] Oleksandr Byelkin
Description:
Subquery with static tables (1 record) and rand() in where clause can't be 
resolved during optimisation (as it can be done for primary query) 

How to repeat:
create table t1 (a int); 
insert into t1 values (1); 
select benchmark(10000, (select a from t1 where a=200*rand())); 
explain select benchmark(10000, (select a from t1 where a=200*rand())); 
drop table t1; 
 

Suggested fix:
Use external table bit with random table bit inside subqueries
[5 Feb 2004 3:35] Oleksandr Byelkin
ChangeSet 
  1.1699 04/02/05 12:32:22 bell@sanja.is.com.ua +5 -0 
  correct processing of rand() in subqueries with static tables (BUG#2645)
[16 Mar 2004 12:34] Oleksandr Byelkin
fixed & pushed