Bug #2645 static table + subquery + rand() = bug
Submitted: 4 Feb 2004 23:25 Modified: 16 Mar 2004 11:34
Reporter: Oleksandr Byelkin Email Updates:
Status: Closed Impact on me:
Category:MySQL Server Severity:S2 (Serious)
Version:4.1 OS:
Assigned to: Oleksandr Byelkin CPU Architecture:Any

[4 Feb 2004 23:25] Oleksandr Byelkin
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 2:35] Oleksandr Byelkin
  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 11:34] Oleksandr Byelkin
fixed & pushed