2000-12-28 03:56:38 +02:00
|
|
|
#
|
|
|
|
# Test of procedure analyse
|
|
|
|
#
|
|
|
|
|
2003-01-06 01:48:59 +02:00
|
|
|
--disable_warnings
|
2001-08-02 06:29:50 +03:00
|
|
|
drop table if exists t1,t2;
|
2003-01-06 01:48:59 +02:00
|
|
|
--enable_warnings
|
2003-03-12 16:43:01 +02:00
|
|
|
create table t1 (i int, j int, empty_string char(10), bool char(1), d date);
|
|
|
|
insert into t1 values (1,2,"","Y","2002-03-03"), (3,4,"","N","2002-03-04"), (5,6,"","Y","2002-03-04"), (7,8,"","N","2002-03-05");
|
2003-01-10 17:36:59 +02:00
|
|
|
select count(*) from t1 procedure analyse();
|
2000-12-28 03:56:38 +02:00
|
|
|
select * from t1 procedure analyse();
|
2003-03-12 16:43:01 +02:00
|
|
|
select * from t1 procedure analyse(2);
|
2000-12-28 03:56:38 +02:00
|
|
|
create table t2 select * from t1 procedure analyse();
|
|
|
|
select * from t2;
|
|
|
|
drop table t1,t2;
|
2002-12-12 16:09:06 +02:00
|
|
|
|
2003-01-06 01:48:59 +02:00
|
|
|
EXPLAIN SELECT 1 FROM (SELECT 1) a PROCEDURE ANALYSE();
|
2004-05-04 15:02:38 +03:00
|
|
|
|
|
|
|
#
|
|
|
|
# Test with impossible where
|
|
|
|
#
|
|
|
|
create table t1 (a int not null);
|
|
|
|
create table t2 select * from t1 where 0=1 procedure analyse();
|
|
|
|
show create table t2;
|
|
|
|
select * from t1 where 0=1 procedure analyse();
|
|
|
|
insert into t1 values(1);
|
|
|
|
drop table t2;
|
|
|
|
create table t2 select * from t1 where 0=1 procedure analyse();
|
|
|
|
show create table t2;
|
|
|
|
select * from t2;
|
|
|
|
insert into t2 select * from t1 procedure analyse();
|
|
|
|
select * from t2;
|
|
|
|
insert into t1 values(2);
|
|
|
|
drop table t2;
|
|
|
|
create table t2 select * from t1 where 0=1 procedure analyse();
|
|
|
|
show create table t2;
|
|
|
|
select * from t2;
|
|
|
|
insert into t2 select * from t1 procedure analyse();
|
|
|
|
select * from t2;
|
|
|
|
drop table t1,t2;
|