Commit 3d4dbe4d authored by Sergei Golubchik's avatar Sergei Golubchik

avoid uppercase table aliases tests - they're not portable

parent bcb85f0e
...@@ -23,9 +23,9 @@ create table t1(a int); ...@@ -23,9 +23,9 @@ create table t1(a int);
insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
create table t2 (col1 int); create table t2 (col1 int);
# one value in 1..100 range # one value in 1..100 range
insert into t2 select A.a + B.a*10 from t1 A, t1 B; insert into t2 select ta.a + tb.a*10 from t1 ta, t1 tb;
# ten values in 100...200 range # ten values in 100...200 range
insert into t2 select 100 + A.a + B.a*10 from t1 A, t1 B, t1 C; insert into t2 select 100 + ta.a + tb.a*10 from t1 ta, t1 tb, t1 tc;
set histogram_type='SINGLE_PREC_HB'; set histogram_type='SINGLE_PREC_HB';
set histogram_size=100; set histogram_size=100;
set optimizer_use_condition_selectivity=4; set optimizer_use_condition_selectivity=4;
...@@ -51,7 +51,7 @@ drop table t1, t2; ...@@ -51,7 +51,7 @@ drop table t1, t2;
create table t0(a int); create table t0(a int);
insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
create table t1(a int); create table t1(a int);
insert into t1 select A.a from t0 A, t0 B, t0 C; insert into t1 select ta.a from t0 ta, t0 tb, t0 tc;
set histogram_size=20; set histogram_size=20;
set histogram_type='single_prec_hb'; set histogram_type='single_prec_hb';
analyze table t1 persistent for all; analyze table t1 persistent for all;
...@@ -90,8 +90,8 @@ drop table t0, t1; ...@@ -90,8 +90,8 @@ drop table t0, t1;
# #
create table t1 (col1 int); create table t1 (col1 int);
set @a=-1; set @a=-1;
create table t2 (a int) select (@a:=@a+1) as a from information_schema.session_variables A limit 100; create table t2 (a int) select (@a:=@a+1) as a from information_schema.session_variables ta limit 100;
insert into t1 select A.a from t2 A, t2 B where A.a < 100 and B.a < 100; insert into t1 select ta.a from t2 ta, t2 tb where ta.a < 100 and tb.a < 100;
select min(col1), max(col1), count(*) from t1; select min(col1), max(col1), count(*) from t1;
min(col1) max(col1) count(*) min(col1) max(col1) count(*)
0 99 10000 0 99 10000
...@@ -123,7 +123,7 @@ drop table t1, t2; ...@@ -123,7 +123,7 @@ drop table t1, t2;
create table t1(a int); create table t1(a int);
insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
create table t2 (a int, b int, col1 varchar(64), col2 varchar(64), key(a,b)); create table t2 (a int, b int, col1 varchar(64), col2 varchar(64), key(a,b));
insert into t2 select A.a+10*B.a, C.a+10*D.a, 'filler-data1', 'filler-data2' from t1 A, t1 B, t1 C, t1 D; insert into t2 select ta.a+10*tb.a, tc.a+10*td.a, 'filler-data1', 'filler-data2' from t1 ta, t1 tb, t1 tc, t1 td;
set histogram_size=100; set histogram_size=100;
set optimizer_use_condition_selectivity=4; set optimizer_use_condition_selectivity=4;
set use_stat_tables='preferably'; set use_stat_tables='preferably';
...@@ -144,7 +144,7 @@ drop table t2, t1; ...@@ -144,7 +144,7 @@ drop table t2, t1;
create table t0(a int); create table t0(a int);
insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
create table t1(key1 int, col1 int, key(key1)); create table t1(key1 int, col1 int, key(key1));
insert into t1 select A.a, A.a from t0 A, t0 B, t0 C; insert into t1 select ta.a, ta.a from t0 ta, t0 tb, t0 tc;
set histogram_size=100; set histogram_size=100;
set use_stat_tables='preferably'; set use_stat_tables='preferably';
set optimizer_use_condition_selectivity=4; set optimizer_use_condition_selectivity=4;
...@@ -177,11 +177,11 @@ key(kp1, kp2) ...@@ -177,11 +177,11 @@ key(kp1, kp2)
); );
insert into t1 insert into t1
select select
A.a, ta.a,
B.a, tb.a,
'filler-data-1', 'filler-data-1',
'filler-data-2' 'filler-data-2'
from t0 A, t0 B, t0 C; from t0 ta, t0 tb, t0 tc;
set histogram_size=100; set histogram_size=100;
set use_stat_tables='preferably'; set use_stat_tables='preferably';
set optimizer_use_condition_selectivity=4; set optimizer_use_condition_selectivity=4;
...@@ -248,7 +248,7 @@ drop table t1,t2; ...@@ -248,7 +248,7 @@ drop table t1,t2;
create table t0(a int); create table t0(a int);
insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
create table t1(a int); create table t1(a int);
insert into t1 select A.a + B.a* 10 + C.a * 100 from t0 A, t0 B, t0 C; insert into t1 select ta.a + tb.a* 10 + tc.a * 100 from t0 ta, t0 tb, t0 tc;
create table t2 as select * from t1; create table t2 as select * from t1;
set histogram_size=100; set histogram_size=100;
set use_stat_tables='preferably'; set use_stat_tables='preferably';
...@@ -262,19 +262,19 @@ Table Op Msg_type Msg_text ...@@ -262,19 +262,19 @@ Table Op Msg_type Msg_text
test.t2 analyze status Engine-independent statistics collected test.t2 analyze status Engine-independent statistics collected
test.t2 analyze status OK test.t2 analyze status OK
# Filtered will be 4.95, 9.90 # Filtered will be 4.95, 9.90
explain extended select * from t1 A, t2 B where A.a < 40 and B.a < 100; explain extended select * from t1 ta, t2 tb where ta.a < 40 and tb.a < 100;
id select_type table type possible_keys key key_len ref rows filtered Extra id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE A ALL NULL NULL NULL NULL 1000 4.95 Using where 1 SIMPLE ta ALL NULL NULL NULL NULL 1000 4.95 Using where
1 SIMPLE B ALL NULL NULL NULL NULL 1000 9.90 Using where; Using join buffer (flat, BNL join) 1 SIMPLE tb ALL NULL NULL NULL NULL 1000 9.90 Using where; Using join buffer (flat, BNL join)
Warnings: Warnings:
Note 1003 select `test`.`A`.`a` AS `a`,`test`.`B`.`a` AS `a` from `test`.`t1` `A` join `test`.`t2` `B` where ((`test`.`A`.`a` < 40) and (`test`.`B`.`a` < 100)) Note 1003 select `test`.`ta`.`a` AS `a`,`test`.`tb`.`a` AS `a` from `test`.`t1` `ta` join `test`.`t2` `tb` where ((`test`.`ta`.`a` < 40) and (`test`.`tb`.`a` < 100))
# Here, B.filtered should not become 100%: # Here, tb.filtered should not become 100%:
explain extended select * from t1 A, t2 B where A.a < 40 and B.a < 100 and B.a=A.a; explain extended select * from t1 ta, t2 tb where ta.a < 40 and tb.a < 100 and tb.a=ta.a;
id select_type table type possible_keys key key_len ref rows filtered Extra id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE A ALL NULL NULL NULL NULL 1000 4.95 Using where 1 SIMPLE ta ALL NULL NULL NULL NULL 1000 4.95 Using where
1 SIMPLE B ALL NULL NULL NULL NULL 1000 4.95 Using where; Using join buffer (flat, BNL join) 1 SIMPLE tb ALL NULL NULL NULL NULL 1000 4.95 Using where; Using join buffer (flat, BNL join)
Warnings: Warnings:
Note 1003 select `test`.`A`.`a` AS `a`,`test`.`B`.`a` AS `a` from `test`.`t1` `A` join `test`.`t2` `B` where ((`test`.`B`.`a` = `test`.`A`.`a`) and (`test`.`A`.`a` < 40) and (`test`.`A`.`a` < 100)) Note 1003 select `test`.`ta`.`a` AS `a`,`test`.`tb`.`a` AS `a` from `test`.`t1` `ta` join `test`.`t2` `tb` where ((`test`.`tb`.`a` = `test`.`ta`.`a`) and (`test`.`ta`.`a` < 40) and (`test`.`ta`.`a` < 100))
drop table t0,t1,t2; drop table t0,t1,t2;
# #
# End of the test file # End of the test file
......
...@@ -30,9 +30,9 @@ insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); ...@@ -30,9 +30,9 @@ insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
create table t2 (col1 int); create table t2 (col1 int);
--echo # one value in 1..100 range --echo # one value in 1..100 range
insert into t2 select A.a + B.a*10 from t1 A, t1 B; insert into t2 select ta.a + tb.a*10 from t1 ta, t1 tb;
--echo # ten values in 100...200 range --echo # ten values in 100...200 range
insert into t2 select 100 + A.a + B.a*10 from t1 A, t1 B, t1 C; insert into t2 select 100 + ta.a + tb.a*10 from t1 ta, t1 tb, t1 tc;
set histogram_type='SINGLE_PREC_HB'; set histogram_type='SINGLE_PREC_HB';
set histogram_size=100; set histogram_size=100;
...@@ -51,7 +51,7 @@ drop table t1, t2; ...@@ -51,7 +51,7 @@ drop table t1, t2;
create table t0(a int); create table t0(a int);
insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
create table t1(a int); create table t1(a int);
insert into t1 select A.a from t0 A, t0 B, t0 C; insert into t1 select ta.a from t0 ta, t0 tb, t0 tc;
set histogram_size=20; set histogram_size=20;
set histogram_type='single_prec_hb'; set histogram_type='single_prec_hb';
analyze table t1 persistent for all; analyze table t1 persistent for all;
...@@ -73,8 +73,8 @@ drop table t0, t1; ...@@ -73,8 +73,8 @@ drop table t0, t1;
--echo # --echo #
create table t1 (col1 int); create table t1 (col1 int);
set @a=-1; set @a=-1;
create table t2 (a int) select (@a:=@a+1) as a from information_schema.session_variables A limit 100; create table t2 (a int) select (@a:=@a+1) as a from information_schema.session_variables ta limit 100;
insert into t1 select A.a from t2 A, t2 B where A.a < 100 and B.a < 100; insert into t1 select ta.a from t2 ta, t2 tb where ta.a < 100 and tb.a < 100;
select min(col1), max(col1), count(*) from t1; select min(col1), max(col1), count(*) from t1;
set histogram_size=100; set histogram_size=100;
analyze table t1 persistent for all; analyze table t1 persistent for all;
...@@ -91,7 +91,7 @@ create table t1(a int); ...@@ -91,7 +91,7 @@ create table t1(a int);
insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
create table t2 (a int, b int, col1 varchar(64), col2 varchar(64), key(a,b)); create table t2 (a int, b int, col1 varchar(64), col2 varchar(64), key(a,b));
insert into t2 select A.a+10*B.a, C.a+10*D.a, 'filler-data1', 'filler-data2' from t1 A, t1 B, t1 C, t1 D; insert into t2 select ta.a+10*tb.a, tc.a+10*td.a, 'filler-data1', 'filler-data2' from t1 ta, t1 tb, t1 tc, t1 td;
set histogram_size=100; set histogram_size=100;
set optimizer_use_condition_selectivity=4; set optimizer_use_condition_selectivity=4;
...@@ -108,7 +108,7 @@ drop table t2, t1; ...@@ -108,7 +108,7 @@ drop table t2, t1;
create table t0(a int); create table t0(a int);
insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
create table t1(key1 int, col1 int, key(key1)); create table t1(key1 int, col1 int, key(key1));
insert into t1 select A.a, A.a from t0 A, t0 B, t0 C; insert into t1 select ta.a, ta.a from t0 ta, t0 tb, t0 tc;
set histogram_size=100; set histogram_size=100;
set use_stat_tables='preferably'; set use_stat_tables='preferably';
...@@ -133,11 +133,11 @@ create table t1 ( ...@@ -133,11 +133,11 @@ create table t1 (
insert into t1 insert into t1
select select
A.a, ta.a,
B.a, tb.a,
'filler-data-1', 'filler-data-1',
'filler-data-2' 'filler-data-2'
from t0 A, t0 B, t0 C; from t0 ta, t0 tb, t0 tc;
set histogram_size=100; set histogram_size=100;
set use_stat_tables='preferably'; set use_stat_tables='preferably';
set optimizer_use_condition_selectivity=4; set optimizer_use_condition_selectivity=4;
...@@ -196,7 +196,7 @@ drop table t1,t2; ...@@ -196,7 +196,7 @@ drop table t1,t2;
create table t0(a int); create table t0(a int);
insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
create table t1(a int); create table t1(a int);
insert into t1 select A.a + B.a* 10 + C.a * 100 from t0 A, t0 B, t0 C; insert into t1 select ta.a + tb.a* 10 + tc.a * 100 from t0 ta, t0 tb, t0 tc;
create table t2 as select * from t1; create table t2 as select * from t1;
set histogram_size=100; set histogram_size=100;
set use_stat_tables='preferably'; set use_stat_tables='preferably';
...@@ -204,9 +204,9 @@ set optimizer_use_condition_selectivity=4; ...@@ -204,9 +204,9 @@ set optimizer_use_condition_selectivity=4;
analyze table t1 persistent for all; analyze table t1 persistent for all;
analyze table t2 persistent for all; analyze table t2 persistent for all;
--echo # Filtered will be 4.95, 9.90 --echo # Filtered will be 4.95, 9.90
explain extended select * from t1 A, t2 B where A.a < 40 and B.a < 100; explain extended select * from t1 ta, t2 tb where ta.a < 40 and tb.a < 100;
--echo # Here, B.filtered should not become 100%: --echo # Here, tb.filtered should not become 100%:
explain extended select * from t1 A, t2 B where A.a < 40 and B.a < 100 and B.a=A.a; explain extended select * from t1 ta, t2 tb where ta.a < 40 and tb.a < 100 and tb.a=ta.a;
drop table t0,t1,t2; drop table t0,t1,t2;
......
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