1934
1934
Tables_in_test (s%)
1935
1935
show tables from test like "t?";
1936
1936
Tables_in_test (t?)
1937
show columns from t2;
1938
Field Type Null Default Default_is_NULL On_Update
1940
fld1 INTEGER NO 0 NO
1941
companynr INTEGER NO 0 NO
1946
show columns from t2 from test like 'f%';
1947
Field Type Null Default Default_is_NULL On_Update
1949
fld1 INTEGER NO 0 NO
1950
companynr INTEGER NO 0 NO
1955
show columns from t2 from test like 's%';
1956
Field Type Null Default Default_is_NULL On_Update
1958
fld1 INTEGER NO 0 NO
1959
companynr INTEGER NO 0 NO
1937
show full columns from t2;
1938
Field Type Collation Null Key Default Extra Privileges Comment
1939
auto int NULL NO PRI NULL auto_increment #
1940
fld1 int NULL NO UNI NULL #
1941
companynr int NULL NO NULL #
1942
fld3 varchar(30) utf8_general_ci NO MUL NULL #
1943
fld4 varchar(35) utf8_general_ci NO NULL #
1944
fld5 varchar(35) utf8_general_ci NO NULL #
1945
fld6 varchar(4) utf8_general_ci NO NULL #
1946
show full columns from t2 from test like 'f%';
1947
Field Type Collation Null Key Default Extra Privileges Comment
1948
fld1 int NULL NO UNI NULL #
1949
fld3 varchar(30) utf8_general_ci NO MUL NULL #
1950
fld4 varchar(35) utf8_general_ci NO NULL #
1951
fld5 varchar(35) utf8_general_ci NO NULL #
1952
fld6 varchar(4) utf8_general_ci NO NULL #
1953
show full columns from t2 from test like 's%';
1954
Field Type Collation Null Key Default Extra Privileges Comment
1964
1955
drop table t4, t3, t2, t1;
1965
1956
CREATE TABLE t1 (
1966
1957
id bigint NOT NULL auto_increment,
1973
1964
SELECT 1 as rnd1 from t1 where rand() > 2;
1976
CREATE TEMPORARY TABLE t1 (gvid int default NULL, hmid int default NULL, volid int default NULL, mmid int default NULL, hdid int default NULL, fsid int default NULL, ctid int default NULL, dtid int default NULL, cost int default NULL, performance int default NULL, serialnumber bigint default NULL, monitored int default '1', removed int default '0', target int default '0', dt_modified timestamp NOT NULL, name varchar(255) default NULL, description varchar(255) default NULL, UNIQUE KEY hmid (hmid,volid)) ENGINE=MyISAM;
1967
CREATE TABLE t1 (gvid int default NULL, hmid int default NULL, volid int default NULL, mmid int default NULL, hdid int default NULL, fsid int default NULL, ctid int default NULL, dtid int default NULL, cost int default NULL, performance int default NULL, serialnumber bigint default NULL, monitored int default '1', removed int default '0', target int default '0', dt_modified timestamp NOT NULL, name varchar(255) binary default NULL, description varchar(255) default NULL, UNIQUE KEY hmid (hmid,volid)) ENGINE=MyISAM;
1977
1968
INSERT INTO t1 VALUES (200001,2,1,1,100,1,1,1,0,0,0,1,0,1,20020425060057,'\\\\ARKIVIO-TESTPDC\\E$',''),(200002,2,2,1,101,1,1,1,0,0,0,1,0,1,20020425060057,'\\\\ARKIVIO-TESTPDC\\C$',''),(200003,1,3,2,NULL,NULL,NULL,NULL,NULL,NULL,NULL,1,0,1,20020425060427,'c:',NULL);
1978
CREATE TEMPORARY TABLE t2 ( hmid int default NULL, volid int default NULL, sampletid int default NULL, sampletime datetime default NULL, samplevalue bigint default NULL, KEY idx1 (hmid,volid,sampletid,sampletime)) ENGINE=MyISAM;
1969
CREATE TABLE t2 ( hmid int default NULL, volid int default NULL, sampletid int default NULL, sampletime datetime default NULL, samplevalue bigint default NULL, KEY idx1 (hmid,volid,sampletid,sampletime)) ENGINE=MyISAM;
1979
1970
INSERT INTO t2 VALUES (1,3,10,'2002-06-01 08:00:00',35),(1,3,1010,'2002-06-01 12:00:01',35);
1980
1971
SELECT a.gvid, (SUM(CASE b.sampletid WHEN 140 THEN b.samplevalue ELSE 0 END)) as the_success,(SUM(CASE b.sampletid WHEN 141 THEN b.samplevalue ELSE 0 END)) as the_fail,(SUM(CASE b.sampletid WHEN 142 THEN b.samplevalue ELSE 0 END)) as the_size,(SUM(CASE b.sampletid WHEN 143 THEN b.samplevalue ELSE 0 END)) as the_time FROM t1 a, t2 b WHERE a.hmid = b.hmid AND a.volid = b.volid AND b.sampletime >= 'wrong-date-value' AND b.sampletime < 'wrong-date-value' AND b.sampletid IN (140, 141, 142, 143) GROUP BY a.gvid;
1981
ERROR HY000: Received an invalid datetime value 'wrong-date-value'.
1972
gvid the_success the_fail the_size the_time
1974
Warning 1292 Incorrect datetime value: 'wrong-date-value' for column 'sampletime' at row 1
1975
Warning 1292 Incorrect datetime value: 'wrong-date-value' for column 'sampletime' at row 1
1982
1976
SELECT a.gvid, (SUM(CASE b.sampletid WHEN 140 THEN b.samplevalue ELSE 0 END)) as the_success,(SUM(CASE b.sampletid WHEN 141 THEN b.samplevalue ELSE 0 END)) as the_fail,(SUM(CASE b.sampletid WHEN 142 THEN b.samplevalue ELSE 0 END)) as the_size,(SUM(CASE b.sampletid WHEN 143 THEN b.samplevalue ELSE 0 END)) as the_time FROM t1 a, t2 b WHERE a.hmid = b.hmid AND a.volid = b.volid AND b.sampletime >= NULL AND b.sampletime < NULL AND b.sampletid IN (140, 141, 142, 143) GROUP BY a.gvid;
1983
1977
gvid the_success the_fail the_size the_time
1984
1978
DROP TABLE t1,t2;
2169
CREATE TEMPORARY TABLE t1 ( aa char(2), id int NOT NULL auto_increment, t2_id int NOT NULL default '0', PRIMARY KEY (id), KEY replace_id (t2_id)) ENGINE=MyISAM;
2163
CREATE TABLE t1 ( aa char(2), id int NOT NULL auto_increment, t2_id int NOT NULL default '0', PRIMARY KEY (id), KEY replace_id (t2_id)) ENGINE=MyISAM;
2170
2164
INSERT INTO t1 VALUES ("1",8264,2506),("2",8299,2517),("3",8301,2518),("4",8302,2519),("5",8303,2520),("6",8304,2521),("7",8305,2522);
2171
CREATE TEMPORARY TABLE t2 ( id int NOT NULL auto_increment, PRIMARY KEY (id)) ENGINE=MyISAM;
2165
CREATE TABLE t2 ( id int NOT NULL auto_increment, PRIMARY KEY (id)) ENGINE=MyISAM;
2172
2166
INSERT INTO t2 VALUES (2517), (2518), (2519), (2520), (2521), (2522);
2173
2167
select * from t1, t2 WHERE t1.t2_id = t2.id and t1.t2_id > 0 order by t1.id LIMIT 0, 5;
2818
2813
insert into t1 values(1,'2005-01-01'),(2,'2005-09-01'),(3,'2005-09-30'),
2819
2814
(4,'2005-10-01'),(5,'2005-12-30');
2820
2815
select * from t1 where f2 >= 0 order by f2;
2821
ERROR HY000: Received an invalid datetime value '0'.
2822
2822
select * from t1 where f2 >= '0000-00-00' order by f2;
2823
ERROR HY000: Received an invalid datetime value '0000-00-00'.
2824
2829
select * from t1 where f2 >= '2005-09-31' order by f2;
2825
ERROR HY000: Received an invalid datetime value '2005-09-31'.
2834
Warning 1292 Incorrect date value: '2005-09-31' for column 'f2' at row 1
2826
2835
select * from t1 where f2 >= '2005-09-3a' order by f2;
2827
ERROR HY000: Received an invalid datetime value '2005-09-3a'.
2841
Warning 1292 Incorrect date value: '2005-09-3a' for column 'f2' at row 1
2828
2842
select * from t1 where f2 <= '2005-09-31' order by f2;
2829
ERROR HY000: Received an invalid datetime value '2005-09-31'.
2848
Warning 1292 Incorrect date value: '2005-09-31' for column 'f2' at row 1
2830
2849
select * from t1 where f2 <= '2005-09-3a' order by f2;
2831
ERROR HY000: Received an invalid datetime value '2005-09-3a'.
2854
Warning 1292 Incorrect date value: '2005-09-3a' for column 'f2' at row 1
2833
2856
CREATE TABLE t1(key_a int4 NOT NULL, optimus varchar(32), PRIMARY KEY(key_a));
2834
2857
CREATE TABLE t2(key_a int4 NOT NULL, prime varchar(32), PRIMARY KEY(key_a));
3586
3613
DROP TABLE t1, t2, t3;
3614
select str_to_date('2007-10-09','%Y-%m-%d') between '2007/10/01 00:00:00 GMT'
3615
and '2007/10/20 00:00:00 GMT';
3616
str_to_date('2007-10-09','%Y-%m-%d') between '2007/10/01 00:00:00 GMT'
3617
and '2007/10/20 00:00:00 GMT'
3620
Warning 1292 Truncated incorrect datetime value: '2007/10/01 00:00:00 GMT'
3621
Warning 1292 Truncated incorrect datetime value: '2007/10/20 00:00:00 GMT'
3622
select str_to_date('2007-10-09','%Y-%m-%d') > '2007/10/01 00:00:00 GMT-6';
3623
str_to_date('2007-10-09','%Y-%m-%d') > '2007/10/01 00:00:00 GMT-6'
3626
Warning 1292 Truncated incorrect date value: '2007/10/01 00:00:00 GMT-6'
3627
select str_to_date('2007-10-09','%Y-%m-%d') <= '2007/10/2000:00:00 GMT-6';
3628
str_to_date('2007-10-09','%Y-%m-%d') <= '2007/10/2000:00:00 GMT-6'
3631
Warning 1292 Truncated incorrect date value: '2007/10/2000:00:00 GMT-6'
3632
select str_to_date('2007-10-01','%Y-%m-%d') = '2007-10-1 00:00:00 GMT-6';
3633
str_to_date('2007-10-01','%Y-%m-%d') = '2007-10-1 00:00:00 GMT-6'
3636
Warning 1292 Truncated incorrect date value: '2007-10-1 00:00:00 GMT-6'
3637
select str_to_date('2007-10-01','%Y-%m-%d') = '2007-10-01 x00:00:00 GMT-6';
3638
str_to_date('2007-10-01','%Y-%m-%d') = '2007-10-01 x00:00:00 GMT-6'
3641
Warning 1292 Truncated incorrect date value: '2007-10-01 x00:00:00 GMT-6'
3642
select str_to_date('2007-10-01','%Y-%m-%d %H:%i:%s') = '2007-10-01 00:00:00 GMT-6';
3643
str_to_date('2007-10-01','%Y-%m-%d %H:%i:%s') = '2007-10-01 00:00:00 GMT-6'
3646
Warning 1292 Truncated incorrect datetime value: '2007-10-01 00:00:00 GMT-6'
3647
select str_to_date('2007-10-01','%Y-%m-%d %H:%i:%s') = '2007-10-01 00:x00:00 GMT-6';
3648
str_to_date('2007-10-01','%Y-%m-%d %H:%i:%s') = '2007-10-01 00:x00:00 GMT-6'
3651
Warning 1292 Truncated incorrect datetime value: '2007-10-01 00:x00:00 GMT-6'
3652
select str_to_date('2007-10-01','%Y-%m-%d %H:%i:%s') = '2007-10-01 x12:34:56 GMT-6';
3653
str_to_date('2007-10-01','%Y-%m-%d %H:%i:%s') = '2007-10-01 x12:34:56 GMT-6'
3656
Warning 1292 Truncated incorrect datetime value: '2007-10-01 x12:34:56 GMT-6'
3657
select str_to_date('2007-10-01 12:34:00','%Y-%m-%d %H:%i:%s') = '2007-10-01 12:34x:56 GMT-6';
3658
str_to_date('2007-10-01 12:34:00','%Y-%m-%d %H:%i:%s') = '2007-10-01 12:34x:56 GMT-6'
3661
Warning 1292 Truncated incorrect datetime value: '2007-10-01 12:34x:56 GMT-6'
3662
select str_to_date('2007-10-01 12:34:56','%Y-%m-%d %H:%i:%s') = '2007-10-01 12:34x:56 GMT-6';
3663
str_to_date('2007-10-01 12:34:56','%Y-%m-%d %H:%i:%s') = '2007-10-01 12:34x:56 GMT-6'
3666
Warning 1292 Truncated incorrect datetime value: '2007-10-01 12:34x:56 GMT-6'
3667
select str_to_date('2007-10-01 12:34:56','%Y-%m-%d %H:%i:%s') = '2007-10-01 12:34:56';
3668
str_to_date('2007-10-01 12:34:56','%Y-%m-%d %H:%i:%s') = '2007-10-01 12:34:56'
3670
select str_to_date('2007-10-01','%Y-%m-%d') = '2007-10-01 12:00:00';
3671
str_to_date('2007-10-01','%Y-%m-%d') = '2007-10-01 12:00:00'
3673
select str_to_date('2007-10-01 12','%Y-%m-%d %H') = '2007-10-01 12:00:00';
3674
str_to_date('2007-10-01 12','%Y-%m-%d %H') = '2007-10-01 12:00:00'
3676
select str_to_date('2007-10-01 12:34','%Y-%m-%d %H') = '2007-10-01 12:00:00';
3677
str_to_date('2007-10-01 12:34','%Y-%m-%d %H') = '2007-10-01 12:00:00'
3680
Warning 1292 Truncated incorrect datetime value: '2007-10-01 12:34'
3681
select str_to_date('2007-02-30 12:34','%Y-%m-%d %H:%i') = '2007-02-30 12:34';
3682
str_to_date('2007-02-30 12:34','%Y-%m-%d %H:%i') = '2007-02-30 12:34'
3685
Warning 1292 Truncated incorrect datetime value: '2007-02-30 12:34'
3686
select str_to_date('2007-10-00 12:34','%Y-%m-%d %H:%i') = '2007-10-00 12:34';
3687
str_to_date('2007-10-00 12:34','%Y-%m-%d %H:%i') = '2007-10-00 12:34'
3689
select str_to_date('2007-10-00','%Y-%m-%d') between '2007/09/01 00:00:00'
3690
and '2007/10/20 00:00:00';
3691
str_to_date('2007-10-00','%Y-%m-%d') between '2007/09/01 00:00:00'
3692
and '2007/10/20 00:00:00'
3694
select str_to_date('2007-10-00','%Y-%m-%d') between '' and '2007/10/20';
3695
str_to_date('2007-10-00','%Y-%m-%d') between '' and '2007/10/20'
3698
Warning 1292 Truncated incorrect datetime value: ''
3699
select str_to_date('','%Y-%m-%d') between '2007/10/01' and '2007/10/20';
3700
str_to_date('','%Y-%m-%d') between '2007/10/01' and '2007/10/20'
3702
select str_to_date('','%Y-%m-%d %H:%i') = '2007-10-01 12:34';
3703
str_to_date('','%Y-%m-%d %H:%i') = '2007-10-01 12:34'
3705
select str_to_date(NULL,'%Y-%m-%d %H:%i') = '2007-10-01 12:34';
3706
str_to_date(NULL,'%Y-%m-%d %H:%i') = '2007-10-01 12:34'
3708
select str_to_date('2007-10-00 12:34','%Y-%m-%d %H:%i') = '';
3709
str_to_date('2007-10-00 12:34','%Y-%m-%d %H:%i') = ''
3712
Warning 1292 Truncated incorrect datetime value: ''
3713
select str_to_date('1','%Y-%m-%d') = '1';
3714
str_to_date('1','%Y-%m-%d') = '1'
3717
Warning 1292 Truncated incorrect date value: '1'
3718
select str_to_date('1','%Y-%m-%d') = '1';
3719
str_to_date('1','%Y-%m-%d') = '1'
3722
Warning 1292 Truncated incorrect date value: '1'
3723
select str_to_date('','%Y-%m-%d') = '';
3724
str_to_date('','%Y-%m-%d') = ''
3727
Warning 1292 Truncated incorrect date value: ''
3728
select str_to_date('1000-01-01','%Y-%m-%d') between '0000-00-00' and NULL;
3729
str_to_date('1000-01-01','%Y-%m-%d') between '0000-00-00' and NULL
3731
select str_to_date('1000-01-01','%Y-%m-%d') between NULL and '2000-00-00';
3732
str_to_date('1000-01-01','%Y-%m-%d') between NULL and '2000-00-00'
3734
select str_to_date('1000-01-01','%Y-%m-%d') between NULL and NULL;
3735
str_to_date('1000-01-01','%Y-%m-%d') between NULL and NULL
3589
3739
# Bug#30736: Row Size Too Large Error Creating a Table and
3673
CREATE TABLE t1 (a INT);
3674
INSERT INTO t1 VALUES (1), (2), (3), (4), (5), (6), (7), (8), (9), (10);
3675
CREATE TABLE t2 (b INT);
3676
INSERT INTO t2 VALUES (2);
3677
SELECT * FROM t1 WHERE a = 1 + 1;
3680
EXPLAIN EXTENDED SELECT * FROM t1 WHERE a = 1 + 1;
3681
id select_type table type possible_keys key key_len ref rows filtered Extra
3682
1 SIMPLE t1 ALL NULL NULL NULL NULL 10 100.00 Using where
3684
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = <cache>((1 + 1)))
3685
SELECT * FROM t1 HAVING a = 1 + 1;
3688
EXPLAIN EXTENDED SELECT * FROM t1 HAVING a = 1 + 1;
3689
id select_type table type possible_keys key key_len ref rows filtered Extra
3690
1 SIMPLE t1 ALL NULL NULL NULL NULL 10 100.00
3692
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` having (`test`.`t1`.`a` = <cache>((1 + 1)))
3693
SELECT * FROM t1, t2 WHERE a = b + (1 + 1);
3696
EXPLAIN EXTENDED SELECT * FROM t1, t2 WHERE a = b + (1 + 1);
3697
id select_type table type possible_keys key key_len ref rows filtered Extra
3698
1 SIMPLE t2 ALL NULL NULL NULL NULL 1 100.00
3699
1 SIMPLE t1 ALL NULL NULL NULL NULL 10 100.00 Using where; Using join buffer
3701
Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t1` join `test`.`t2` where (`test`.`t1`.`a` = (`test`.`t2`.`b` + <cache>((1 + 1))))
3702
SELECT * FROM t2 LEFT JOIN t1 ON a = b + 1;
3705
EXPLAIN EXTENDED SELECT * FROM t2 LEFT JOIN t1 ON a = b + 1;
3706
id select_type table type possible_keys key key_len ref rows filtered Extra
3707
1 SIMPLE t2 ALL NULL NULL NULL NULL 1 100.00
3708
1 SIMPLE t1 ALL NULL NULL NULL NULL 10 100.00
3710
Note 1003 select `test`.`t2`.`b` AS `b`,`test`.`t1`.`a` AS `a` from `test`.`t2` left join `test`.`t1` on((`test`.`t1`.`a` = (`test`.`t2`.`b` + 1))) where 1
3711
EXPLAIN EXTENDED SELECT * FROM t1 WHERE a > UNIX_TIMESTAMP('2009-03-10 00:00:00');
3712
id select_type table type possible_keys key key_len ref rows filtered Extra
3713
1 SIMPLE t1 ALL NULL NULL NULL NULL 10 100.00 Using where
3715
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` > <cache>(unix_timestamp('2009-03-10 00:00:00')))