~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to tests/t/select_safe.test

  • Committer: Prafulla Tekawade
  • Date: 2010-07-13 16:07:35 UTC
  • mto: (1662.1.4 rollup)
  • mto: This revision was merged to the branch mainline in revision 1664.
  • Revision ID: prafulla_t@users.sourceforge.net-20100713160735-2fsdtrm3azayuyu1
This bug is simillar to mysql bug 36133
http://bugs.mysql.com/bug.php?id=36133

Taking changes from that fix.

  - The problem was that the range optimizer evaluated constant expressions, 
    and among them it would try to evaluate IN-subquery predicates slated for
    handling with materialization strategy. However, these predicates require
    that parent_join->setup_subquery_materialization() is invoked before one
    attempts to evaluate them.
  
  - Fixed by making the range optimizer not to evaluate expressions that have
    item->is_expensive() == TRUE (these are materialization subqueries and 
    stored function calls). This should also resolve the problem that EXPLAIN 
    may be too long. 
    This change cuts off some opportunities for range optimizer, but this is 
    the price we're willing to pay for separation of query optimization and
    execution. 

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
--sorted_result
18
18
SELECT SQL_BUFFER_RESULT * from t1;
19
19
update t1 set b="a" where a=1;
20
 
select 1 from t1 CROSS JOIN t1 as t2 CROSS JOIN t1 as t3;
 
20
select 1 from t1,t1 as t2,t1 as t3;
21
21
 
22
22
# The following should NOT give errors:
23
23
update t1 set b="a";
25
25
delete from t1;
26
26
delete from t1 where b="test";
27
27
delete from t1 where a+0=1;
28
 
select 1 from t1 CROSS JOIN t1 as t2 CROSS JOIN t1 as t3 CROSS JOIN t1 as t4 CROSS JOIN t1 as t5;
 
28
select 1 from t1,t1 as t2,t1 as t3,t1 as t4,t1 as t5;
29
29
 
30
30
# The following should be ok:
31
31
update t1 set b="a" limit 1;
39
39
SET MAX_JOIN_SIZE=2;
40
40
SELECT @@MAX_JOIN_SIZE, @@SQL_BIG_SELECTS;
41
41
insert into t1 values (null,"a"),(null,"a"),(null,"a"),(null,"a"),(null,"a"),(null,"a"),(null,"a"),(null,"a"),(null,"a"),(null,"a");
42
 
--error ER_TOO_BIG_SELECT
 
42
--error 1104
43
43
SELECT * from t1 order by a;
44
44
SET SQL_BIG_SELECTS=1;
45
45
SELECT * from t1 order by a;
46
46
SET MAX_JOIN_SIZE=2;
47
 
--error ER_TOO_BIG_SELECT
 
47
--error 1104
48
48
SELECT * from t1;
49
49
SET MAX_JOIN_SIZE=DEFAULT;
50
50
SELECT * from t1;
69
69
insert into t1 select * from t1;
70
70
 
71
71
set local  max_join_size=8;
72
 
--error ER_TOO_BIG_SELECT
 
72
--error 1104
73
73
select * from (select * from t1) x;
74
74
 
75
75
set local  max_join_size=1;
76
 
--error ER_TOO_BIG_SELECT
 
76
--error 1104
77
77
select * from (select a.a as aa, b.a as ba from t1 a, t1 b) x;
78
78
 
79
79
set local  max_join_size=1;
80
 
--error ER_TOO_BIG_SELECT
 
80
--error 1104
81
81
select * from (select 1 union select 2 union select 3) x;
82
82
drop table t1;
83
83