Commit f1a7358d authored by Igor Babaev's avatar Igor Babaev

Fixed LP bug #784848 that caused failures of func_str.test and

derived_view.test.
Do not register Item_ref objects of the type VIEW_REF as outer
references.
parent 78794f32
......@@ -354,6 +354,11 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 11 100.00 Using where
Warnings:
Note 1003 select `test`.`t1`.`f1` AS `f1`,`test`.`t1`.`f11` AS `f11` from `test`.`t1` where ((`test`.`t1`.`f1` > 2) and (`test`.`t1`.`f1` < 7))
select * from (select * from
(select * from t1 where f1 < 7) tt where f1 > 2) zz;
f1 f11
3 3
5 5
materialized derived in merged derived
explain extended select * from (select * from
(select * from t1 where f1 < 7 group by f1) tt where f1 > 2) zz;
......@@ -375,6 +380,11 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
2 DERIVED t1 ALL NULL NULL NULL NULL 11 100.00 Using where; Using temporary; Using filesort
Warnings:
Note 1003 select `zz`.`f1` AS `f1`,`zz`.`f11` AS `f11` from (select `test`.`t1`.`f1` AS `f1`,`test`.`t1`.`f11` AS `f11` from `test`.`t1` where ((`test`.`t1`.`f1` > 2) and (`test`.`t1`.`f1` < 7)) group by `test`.`t1`.`f1`) `zz`
select * from (select * from
(select * from t1 where f1 < 7) tt where f1 > 2 group by f1) zz;
f1 f11
3 3
5 5
materialized derived in materialized derived
explain extended select * from (select * from
(select * from t1 where f1 < 7 group by f1) tt where f1 > 2 group by f1) zz;
......@@ -433,6 +443,16 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 11 100.00 Using where; Using join buffer (flat, BNL join)
Warnings:
Note 1003 select `test`.`t1`.`f1` AS `f1`,`test`.`t1`.`f11` AS `f11`,`test`.`t1`.`f1` AS `f1`,`test`.`t1`.`f11` AS `f11` from `test`.`t1` join `test`.`t1` where ((`test`.`t1`.`f1` = `test`.`t1`.`f1`) and (`test`.`t1`.`f1` > 2) and (`test`.`t1`.`f1` < 7) and (`test`.`t1`.`f1` > 2) and (`test`.`t1`.`f1` < 7))
select * from
(select * from
(select * from t1 where f1 < 7 ) tt where f1 > 2 ) x
join
(select * from
(select * from t1 where f1 < 7 ) tt where f1 > 2 ) z
on x.f1 = z.f1;
f1 f11 f1 f11
3 3 3 3
5 5 5 5
materialized in materialized derived join
materialized in materialized derived
explain extended select * from
......@@ -469,6 +489,10 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
2 DERIVED t2 ALL NULL NULL NULL NULL 11 100.00 Using where; Using temporary; Using filesort
Warnings:
Note 1003 select `tt`.`f2` AS `f2`,`tt`.`f22` AS `f22` from (select `test`.`t2`.`f2` AS `f2`,`test`.`t2`.`f22` AS `f22` from `test`.`t2` where (`test`.`t2`.`f2` in (2,3)) group by 1) `tt`
select * from (select * from v4 group by 1) tt;
f2 f22
2 2
3 3
materialized view in merged derived
explain extended
select * from ( select * from v1 where f1 < 7) tt;
......@@ -490,6 +514,10 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 ALL NULL NULL NULL NULL 11 100.00 Using where
Warnings:
Note 1003 select `test`.`t2`.`f2` AS `f2`,`test`.`t2`.`f22` AS `f22` from `test`.`t2` where ((`test`.`t2`.`f2` < 7) and (`test`.`t2`.`f2` in (2,3)))
select * from (select * from v6) tt;
f2 f22
3 3
2 2
materialized view in a merged view in a materialized derived
create view v7 as select * from v1;
explain extended select * from (select * from v7 group by 1) tt;
......@@ -499,6 +527,19 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
4 DERIVED t1 ALL NULL NULL NULL NULL 11 100.00 Using temporary; Using filesort
Warnings:
Note 1003 select `tt`.`f1` AS `f1`,`tt`.`f11` AS `f11` from (select `v1`.`f1` AS `f1`,`v1`.`f11` AS `f11` from `test`.`v1` group by 1) `tt`
select * from (select * from v7 group by 1) tt;
f1 f11
1 1
2 2
3 3
5 5
7 7
9 9
11 11
13 13
15 15
17 17
19 19
join of above two
explain extended select * from v6 join v7 on f2=f1;
id select_type table type possible_keys key key_len ref rows filtered Extra
......
......@@ -2395,6 +2395,18 @@ C
4194326291
2366072709
2707236321
SELECT * FROM (SELECT * FROM v1) x;
C
2212294583
450215437
1842515611
4088798008
2226203566
498629140
1790921346
4194326291
2366072709
2707236321
DROP TABLE t1, t2;
DROP VIEW v1;
SELECT LOCATE('foo', NULL) FROM DUAL;
......
......@@ -110,10 +110,8 @@ select * from v1 join v4 on f1=f2;
--echo merged derived in merged derived
explain extended select * from (select * from
(select * from t1 where f1 < 7) tt where f1 > 2) zz;
# !!! This query crashes the server in ps-protocol due to a bug in the code of mwl106
# !!! Uncomment it when the bug is fixed
# select * from (select * from
# (select * from t1 where f1 < 7) tt where f1 > 2) zz;
select * from (select * from
(select * from t1 where f1 < 7) tt where f1 > 2) zz;
--echo materialized derived in merged derived
explain extended select * from (select * from
......@@ -124,10 +122,8 @@ select * from (select * from
--echo merged derived in materialized derived
explain extended select * from (select * from
(select * from t1 where f1 < 7) tt where f1 > 2 group by f1) zz;
# !!! This query crashes the server in ps-protocol due to a bug in the code of mwl106
# !!! Uncomment it when the bug is fixed
# select * from (select * from
# (select * from t1 where f1 < 7) tt where f1 > 2 group by f1) zz;
select * from (select * from
(select * from t1 where f1 < 7) tt where f1 > 2 group by f1) zz;
--echo materialized derived in materialized derived
explain extended select * from (select * from
......@@ -160,15 +156,13 @@ join
(select * from t1 where f1 < 7 ) tt where f1 > 2 ) z
on x.f1 = z.f1;
# !!! This query crashes the server in ps-protocol due to a bug in the code of mwl106
# !!! Uncomment it when the bug is fixed
# select * from
# (select * from
# (select * from t1 where f1 < 7 ) tt where f1 > 2 ) x
# join
# (select * from
# (select * from t1 where f1 < 7 ) tt where f1 > 2 ) z
# on x.f1 = z.f1;
select * from
(select * from
(select * from t1 where f1 < 7 ) tt where f1 > 2 ) x
join
(select * from
(select * from t1 where f1 < 7 ) tt where f1 > 2 ) z
on x.f1 = z.f1;
--echo materialized in materialized derived join
--echo materialized in materialized derived
......@@ -191,9 +185,7 @@ join
--echo merged view in materialized derived
explain extended
select * from (select * from v4 group by 1) tt;
# !!! This query crashes the server in ps-protocol due to a bug in the code of mwl106
# !!! Uncomment it when the bug is fixed
# select * from (select * from v4 group by 1) tt;
select * from (select * from v4 group by 1) tt;
--echo materialized view in merged derived
explain extended
......@@ -203,16 +195,12 @@ select * from ( select * from v1 where f1 < 7) tt;
--echo merged view in a merged view in a merged derived
create view v6 as select * from v4 where f2 < 7;
explain extended select * from (select * from v6) tt;
# !!! This query crashes the server in ps-protocol due to a bug in the code of mwl106
# !!! Uncomment it when the bug is fixed
# select * from (select * from v6) tt;
select * from (select * from v6) tt;
--echo materialized view in a merged view in a materialized derived
create view v7 as select * from v1;
explain extended select * from (select * from v7 group by 1) tt;
# !!! This query crashes the server in ps-protocol due to a bug in the code of mwl106
# !!! Uncomment it when the bug is fixed
# select * from (select * from v7 group by 1) tt;
select * from (select * from v7 group by 1) tt;
--echo join of above two
explain extended select * from v6 join v7 on f2=f1;
......
......@@ -1198,9 +1198,7 @@ SELECT * FROM (SELECT CRC32(a) FROM t1) t2;
CREATE TABLE t2 SELECT CRC32(a) FROM t1;
desc t2;
SELECT * FROM v1;
# !!! This query crashes the server in ps-protocol due to a bug in the code of mwl106
# !!! Uncomment it when the bug is fixed
# SELECT * FROM (SELECT * FROM v1) x;
SELECT * FROM (SELECT * FROM v1) x;
DROP TABLE t1, t2;
DROP VIEW v1;
......
......@@ -223,7 +223,7 @@ use mysqltest;
# update with rights on VIEW column
update t2,v1 set v1.a=v1.a+v1.c where t2.x=v1.c;
select * from t1;
# !!! This query failsin ps-protocol due to a bug in the code of mwl106
# !!! This query fails in ps-protocol due to a bug in the code of mwl106
# !!! Uncomment it when the bug is fixed
# update v1 set a=a+c;
select * from t1;
......
......@@ -6295,7 +6295,7 @@ bool Item_ref::fix_fields(THD *thd, Item **reference)
last_checked_context->select_lex->nest_level);
}
}
else
else if (ref_type() != VIEW_REF)
{
if (depended_from && reference)
{
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment