2000-12-28 02:56:38 +01:00
#
# Test of procedure analyse
#
2003-01-06 00:48:59 +01:00
--disable_warnings
2001-08-02 05:29:50 +02:00
drop table if exists t1,t2;
2003-01-06 00:48:59 +01:00
--enable_warnings
2003-03-12 15:43:01 +01: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 16:36:59 +01:00
select count(*) from t1 procedure analyse();
2000-12-28 02:56:38 +01:00
select * from t1 procedure analyse();
2003-03-12 15:43:01 +01:00
select * from t1 procedure analyse(2);
2000-12-28 02:56:38 +01:00
create table t2 select * from t1 procedure analyse();
select * from t2;
drop table t1,t2;
2002-12-12 15:09:06 +01:00
2003-01-06 00:48:59 +01:00
EXPLAIN SELECT 1 FROM (SELECT 1) a PROCEDURE ANALYSE();
2004-05-04 14:02:38 +02: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;
2005-01-12 21:55:10 +01:00
#
# Bug#2813 - analyse does not quote string values in enums from string
#
2005-01-11 18:40:33 +01:00
create table t1 (v varchar(128));
insert into t1 values ('abc'),('abc\'def\\hij\"klm\0opq'),('\''),('\"'),('\\'),('a\0'),('b\''),('c\"'),('d\\'),('\'b'),('\"c'),('\\d'),('a\0\0\0b'),('a\'\'\'\'b'),('a\"\"\"\"b'),('a\\\\\\\\b'),('\'\0\\\"'),('\'\''),('\"\"'),('\\\\'),('The\ZEnd');
select * from t1 procedure analyse();
drop table t1;