mirror of
https://github.com/MariaDB/server.git
synced 2025-01-31 19:11:46 +01:00
2288b84df4
Fix Item_ident::print() to work when there is no current database
69 lines
1.7 KiB
Text
69 lines
1.7 KiB
Text
#
|
|
# Tests for "ANALYZE FORMAT=JSON $statement" syntax
|
|
#
|
|
--disable_warnings
|
|
drop table if exists t0,t1,t2,t3;
|
|
--enable_warnings
|
|
|
|
create table t0 (a int);
|
|
INSERT INTO t0 VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
|
|
|
|
--echo # r_filtered=30%, because 3 rows match: 0,1,2
|
|
analyze format=json select * from t0 where a<3;
|
|
|
|
create table t1 (a int, b int, c int, key(a));
|
|
insert into t1 select A.a*10 + B.a, A.a*10 + B.a, A.a*10 + B.a from t0 A, t0 B;
|
|
|
|
analyze
|
|
select * from t0, t1 where t1.a=t0.a and t0.a > 9;
|
|
analyze format=json
|
|
select * from t0, t1 where t1.a=t0.a and t0.a > 9;
|
|
|
|
analyze
|
|
select * from t0, t1 where t1.a=t0.a and t1.b<4;
|
|
|
|
analyze format=json
|
|
select * from t0, t1 where t1.a=t0.a and t1.b<4;
|
|
|
|
analyze
|
|
select * from t1 tbl1, t1 tbl2 where tbl1.b<2 and tbl2.b>5;
|
|
|
|
analyze format=json
|
|
select * from t1 tbl1, t1 tbl2 where tbl1.b<20 and tbl2.b<60;
|
|
|
|
analyze format=json
|
|
select * from t1 tbl1, t1 tbl2 where tbl1.b<20 and tbl2.b<60 and tbl1.c > tbl2.c;
|
|
|
|
drop table t1;
|
|
drop table t0;
|
|
|
|
--echo #
|
|
--echo # MDEV-7674: ANALYZE shows r_rows=0
|
|
--echo #
|
|
|
|
create table t1(a int);
|
|
insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
|
|
|
|
create table t2 (a int, key(a));
|
|
insert into t2 values (0),(1);
|
|
|
|
analyze format=json select * from t1 straight_join t2 force index(a) where t2.a=t1.a;
|
|
|
|
drop table t1,t2;
|
|
|
|
create table t1(a int);
|
|
insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
|
|
|
|
--echo #
|
|
--echo # MDEV-7679: ANALYZE crashes when printing WHERE when no default db
|
|
--echo #
|
|
|
|
select database();
|
|
connect (con1,localhost,root,,*NO-ONE*);
|
|
connection con1;
|
|
select database();
|
|
analyze format=json select * from test.t1 where t1.a<5;
|
|
disconnect con1;
|
|
connection default;
|
|
drop table t1;
|
|
|