~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to tests/t/myisam.test

Merge in security refactor.

Show diffs side-by-side

added added

removed removed

Lines of Context:
30
30
# Test problem with rows that are 65517-65520 bytes long
31
31
#
32
32
 
33
 
create temporary table t1 (a int not null auto_increment, b blob not null, primary key (a)) engine=myisam;
 
33
create table t1 (a int not null auto_increment, b blob not null, primary key (a));
34
34
 
35
35
let $1=100;
36
36
disable_query_log;
329
329
# Test of creating table with too long key
330
330
#
331
331
 
332
 
--error ER_TOO_LONG_KEY
 
332
--error 1071
333
333
CREATE TEMPORARY TABLE t1 (a varchar(300), b varchar(300), c varchar(300), d varchar(300), e varchar(300), KEY t1 (a, b, c, d, e)) ENGINE=MyISAM;
334
334
CREATE TEMPORARY TABLE t1 (a varchar(300), b varchar(300), c varchar(300), d varchar(300), e varchar(300)) ENGINE=MyISAM;
335
 
--error ER_TOO_LONG_KEY
 
335
--error 1071
336
336
ALTER TABLE t1 ADD INDEX t1 (a, b, c, d, e);
337
337
DROP TABLE t1;
338
338
 
342
342
 
343
343
CREATE TEMPORARY TABLE t1 (a int not null, b int, c int, key(b), key(c), key(a,b), key(c,a)) ENGINE=MyISAM;
344
344
INSERT into t1 values (0, null, 0), (0, null, 1), (0, null, 2), (0, null,3), (1,1,4);
345
 
create temporary table t2 (a int not null, b int, c int, key(b), key(c), key(a)) engine=myisam;
 
345
create table t2 (a int not null, b int, c int, key(b), key(c), key(a));
346
346
INSERT into t2 values (1,1,1), (2,2,2);
347
347
alter table t1 ENGINE=MYISAM;
348
348
show index from t1;
361
361
# Test bug when updating a split dynamic row where keys are not changed
362
362
#
363
363
 
364
 
create temporary table t1 (a int not null auto_increment primary key, b varchar(255)) engine=myisam;
 
364
create table t1 (a int not null auto_increment primary key, b varchar(255));
365
365
insert into t1 (b) values (repeat('a',100)),(repeat('b',100)),(repeat('c',100));
366
366
update t1 set b=repeat(left(b,1),200) where a=1;
367
367
 
441
441
#
442
442
# Verify blob handling
443
443
#
444
 
create temporary table t1 (a blob) engine=myisam;
 
444
create table t1 (a blob);
445
445
insert into t1 values('a '),('a');
446
446
select concat(a,'.') from t1 where a='a';
447
447
select concat(a,'.') from t1 where a='a ';
453
453
#
454
454
# Test text and unique
455
455
#
456
 
create temporary table t1 (a int not null auto_increment primary key, b text not null, unique b (b(20))) engine=myisam;
 
456
create table t1 (a int not null auto_increment primary key, b text not null, unique b (b(20)));
457
457
insert into t1 (b) values ('a'),('b'),('c');
458
458
select concat(b,'.') from t1;
459
459
update t1 set b='b ' where a=2;
469
469
#
470
470
# Test keys with 0 segments. (Bug #3203)
471
471
#
472
 
create temporary table t1 (a int not null) engine=myisam;
473
 
create temporary table t2 (a int not null, primary key (a)) engine=myisam;
 
472
create table t1 (a int not null);
 
473
create table t2 (a int not null, primary key (a));
474
474
insert into t1 values (1);
475
475
insert into t2 values (1),(2);
476
476
select sql_big_result distinct t1.a from t1,t2 order by t2.a;
494
494
 
495
495
# End of 4.0 tests
496
496
 
497
 
create temporary table t1 (a int, b varchar(200), c text not null) engine=myisam;
498
 
create temporary table t2 (a int, b varchar(200), c text not null) engine=myisam;
 
497
create table t1 (a int, b varchar(200), c text not null);
 
498
create table t2 (a int, b varchar(200), c text not null);
499
499
insert t1 values (1, "aaa", "bbb"), (NULL, "", "ccccc"), (0, NULL, "");
500
500
insert t2 select * from t1;
501
 
--replace_column 1 #  6 # 7 # 8 # 9 # 10 #
502
 
show table status;
 
501
checksum table t1, t2, t3;
 
502
checksum table t1, t2, t3;
 
503
checksum table t1, t2, t3;
 
504
#show table status;
503
505
drop table t1,t2;
504
506
 
505
507
#@TODO Figure out what the heck the below is testing.
531
533
#
532
534
# index search for NULL in blob. Bug #4816
533
535
#
534
 
create temporary table t1 ( a tinytext, b char(1), index idx (a(1),b) ) engine=myisam;
 
536
create table t1 ( a tinytext, b char(1), index idx (a(1),b) );
535
537
insert into t1 values (null,''), (null,'');
536
538
explain select count(*) from t1 where a is null;
537
539
select count(*) from t1 where a is null;
540
542
#
541
543
# bug9188 - Corruption Can't open file: 'table.MYI' (errno: 145)
542
544
#
543
 
create temporary table t1 (c1 int, c2 varchar(4) not null default '',
544
 
                 key(c2(3))) engine=myisam;
 
545
create table t1 (c1 int, c2 varchar(4) not null default '',
 
546
                 key(c2(3)));
545
547
insert into t1 values (1,'A'), (2, 'B'), (3, 'A');
546
548
update t1 set c2='A  B' where c1=2;
547
549
check table t1;
548
550
drop table t1;
549
551
 
 
552
 
 
553
#
 
554
# Bug#12296 - CHECKSUM TABLE reports 0 for the table
 
555
# This happened if the first record was marked as deleted.
 
556
#
 
557
create table t1 (c1 int);
 
558
insert into t1 values (1),(2),(3),(4);
 
559
checksum table t1;
 
560
delete from t1 where c1 = 1;
 
561
create table t2 as select * from t1;
 
562
# The following returns 0 with the bug in place.
 
563
checksum table t1;
 
564
# The above should give the same number as the following.
 
565
checksum table t2;
 
566
drop table t1, t2;
 
567
 
550
568
# BUG#13814 - key value packed incorrectly for TINYBLOBs
551
569
 
552
 
create temporary table t1(
 
570
create table t1(
553
571
  cip INT NOT NULL,
554
572
  score INT NOT NULL DEFAULT 0,
555
573
  bob TINYBLOB
556
 
) engine=myisam;
 
574
);
557
575
 
558
576
insert into t1 (cip) VALUES (1), (2), (3);
559
577
insert into t1 (cip, bob) VALUES (4, 'a' ), (5, 'b'), 
596
614
#
597
615
# Bug#8283 - OPTIMIZE TABLE causes data loss
598
616
#
 
617
SET GLOBAL myisam_repair_threads=2;
 
618
SHOW VARIABLES LIKE 'myisam_repair%';
 
619
#
599
620
# Test OPTIMIZE. This creates a new data file.
600
621
CREATE TEMPORARY TABLE t1 (
601
622
  `_id` int NOT NULL default '0',
628
649
#
629
650
SELECT _id FROM t1;
630
651
DELETE FROM t1 WHERE _id < 8;
631
 
--replace_column 1 #  6 # 7 # 8 # 9 # 10 #
632
 
show table status LIKE 't1';
 
652
--replace_column 6 # 7 # 8 # 9 # 11 # 12 # 13 # 14 # 15 # 16 #
 
653
SHOW TABLE STATUS LIKE 't1';
633
654
CHECK TABLE t1;
634
655
ALTER TABLE t1 ENGINE=MYISAM;
635
656
CHECK TABLE t1;
636
 
--replace_column 1 #  6 # 7 # 8 # 9 # 10 #
637
 
show table status LIKE 't1';
 
657
--replace_column 6 # 7 # 8 # 9 # 11 # 12 # 13 # 14 # 15 # 16 #
 
658
SHOW TABLE STATUS LIKE 't1';
638
659
SELECT _id FROM t1;
639
660
DROP TABLE t1;
 
661
#
 
662
SET GLOBAL myisam_repair_threads=1;
 
663
SHOW VARIABLES LIKE 'myisam_repair%';
640
664
 
641
665
#
642
666
# Bug#24607 - MyISAM pointer size determined incorrectly
643
667
#
644
668
CREATE TEMPORARY TABLE t1 (c1 TEXT) ENGINE=MyISAM;
645
 
--replace_column 1 #  6 # 7 # 8 # 9 # 10 #
646
 
show table status like 't1';
 
669
--replace_column 5 X 6 X 7 X 9 X 10 X 11 X 12 X 13 X 14 X 16 X
 
670
SHOW TABLE STATUS LIKE 't1';
647
671
DROP TABLE t1;
648
672
 
649
673
#
805
829
# Some errors/warnings on create
806
830
#
807
831
 
808
 
--error ER_TOO_BIG_FIELDLENGTH
 
832
--error 1074
809
833
create temporary table t1 (v varchar(65530), key(v));
810
 
--error ER_TOO_BIG_FIELDLENGTH
 
834
--error 1074
811
835
create temporary table t1 (v varchar(65536));
812
 
--error ER_TOO_BIG_FIELDLENGTH
 
836
--error 1074
813
837
create temporary table t1 (v varchar(65530));
814
838
 
815
839
# MyISAM specific varchar tests
816
 
--error ER_TOO_BIG_FIELDLENGTH
 
840
--error 1074
817
841
create temporary table t1 (v varchar(65535));
818
842
 
819
843
eval set storage_engine=$default;
821
845
 
822
846
# BUG#9622 - ANALYZE TABLE and ALTER TABLE .. ENABLE INDEX produce
823
847
# different statistics on the same table with NULL values.
824
 
create temporary table t1 (a int, key(a)) engine=myisam;
 
848
create table t1 (a int, key(a));
825
849
 
826
850
insert into t1 values (1),(2),(3),(4),(NULL),(NULL),(NULL),(NULL);
827
851
analyze table t1;
854
878
# Bug#4692 - DISABLE/ENABLE KEYS waste a space
855
879
#
856
880
CREATE TEMPORARY TABLE t1 (c1 INT, c2 INT, UNIQUE INDEX (c1), INDEX (c2)) ENGINE=MYISAM;
857
 
--replace_column 1 #  6 # 7 # 8 # 9 # 10 #
858
 
show table status like 't1';
 
881
--replace_column 6 # 7 # 8 # 10 # 11 # 12 # 13 # 14 # 15 # 16 #
 
882
SHOW TABLE STATUS LIKE 't1';
859
883
INSERT INTO t1 VALUES (1,1);
860
 
--replace_column 1 #  6 # 7 # 8 # 9 # 10 #
861
 
show table status like 't1';
862
 
ALTER TABLE t1 DISABLE KEYS;
863
 
--replace_column 1 #  6 # 7 # 8 # 9 # 10 #
864
 
show table status like 't1';
865
 
ALTER TABLE t1 ENABLE KEYS;
866
 
--replace_column 1 #  6 # 7 # 8 # 9 # 10 #
867
 
show table status like 't1';
868
 
ALTER TABLE t1 DISABLE KEYS;
869
 
--replace_column 1 #  6 # 7 # 8 # 9 # 10 #
870
 
show table status like 't1';
871
 
ALTER TABLE t1 ENABLE KEYS;
872
 
--replace_column 1 #  6 # 7 # 8 # 9 # 10 #
873
 
show table status like 't1';
 
884
--replace_column 6 # 7 # 8 # 10 # 11 # 12 # 13 # 14 # 15 # 16 #
 
885
SHOW TABLE STATUS LIKE 't1';
 
886
ALTER TABLE t1 DISABLE KEYS;
 
887
--replace_column 6 # 7 # 8 # 10 # 11 # 12 # 13 # 14 # 15 # 16 #
 
888
SHOW TABLE STATUS LIKE 't1';
 
889
ALTER TABLE t1 ENABLE KEYS;
 
890
--replace_column 6 # 7 # 8 # 10 # 11 # 12 # 13 # 14 # 15 # 16 #
 
891
SHOW TABLE STATUS LIKE 't1';
 
892
ALTER TABLE t1 DISABLE KEYS;
 
893
--replace_column 6 # 7 # 8 # 10 # 11 # 12 # 13 # 14 # 15 # 16 #
 
894
SHOW TABLE STATUS LIKE 't1';
 
895
ALTER TABLE t1 ENABLE KEYS;
 
896
--replace_column 6 # 7 # 8 # 10 # 11 # 12 # 13 # 14 # 15 # 16 #
 
897
SHOW TABLE STATUS LIKE 't1';
874
898
#--exec ls -log var/master-data/test/t1.MYI
875
899
#--exec myisamchk -dvv var/master-data/test/t1.MYI
876
900
#--exec myisamchk -iev var/master-data/test/t1.MYI
877
901
--echo # Enable keys with parallel repair
 
902
SET GLOBAL myisam_repair_threads=2;
878
903
ALTER TABLE t1 DISABLE KEYS;
879
904
ALTER TABLE t1 ENABLE KEYS;
 
905
SET GLOBAL myisam_repair_threads=1;
880
906
CHECK TABLE t1;
881
907
DROP TABLE t1;
882
908
 
899
925
 
900
926
 
901
927
#
 
928
# Test of key_block_size
 
929
#
 
930
 
 
931
create temporary table t1 (a int not null, key `a` (a) key_block_size=1024) ENGINE=MyISAM;
 
932
show create table t1;
 
933
drop table t1;
 
934
 
 
935
create temporary table t1 (a int not null, key `a` (a) key_block_size=2048) ENGINE=MyISAM;
 
936
show create table t1;
 
937
drop table t1;
 
938
 
 
939
create temporary table t1 (a varchar(2048), key `a` (a)) ENGINE=MyISAM;
 
940
show create table t1;
 
941
drop table t1;
 
942
 
 
943
create temporary table t1 (a varchar(2048), key `a` (a) key_block_size=1024) ENGINE=MyISAM;
 
944
show create table t1;
 
945
drop table t1;
 
946
 
 
947
create temporary table t1 (a int not null, b varchar(2048), key (a), key(b)) ENGINE=MyISAM key_block_size=1024;
 
948
show create table t1;
 
949
alter table t1 key_block_size=2048;
 
950
show create table t1;
 
951
alter table t1 add c int, add key (c);
 
952
show create table t1;
 
953
alter table t1 key_block_size=0;
 
954
alter table t1 add d int, add key (d);
 
955
show create table t1;
 
956
drop table t1;
 
957
 
 
958
create temporary table t1 (a int not null, b varchar(2048), key (a), key(b)) ENGINE=MyISAM key_block_size=8192;
 
959
show create table t1;
 
960
drop table t1;
 
961
 
 
962
create temporary table t1 (a int not null, b varchar(2048), key (a) key_block_size=1024, key(b)) ENGINE=MyISAM key_block_size=8192;
 
963
show create table t1;
 
964
drop table t1;
 
965
 
 
966
create temporary table t1 (a int not null, b int, key (a) key_block_size=1024, key(b) key_block_size=8192) ENGINE=MyISAM key_block_size=16384;
 
967
show create table t1;
 
968
drop table t1;
 
969
 
 
970
 
 
971
# Test limits and errors of key_block_size
 
972
 
 
973
create temporary table t1 (a int not null, key `a` (a) key_block_size=512) ENGINE=MyISAM;
 
974
show create table t1;
 
975
drop table t1;
 
976
 
 
977
create temporary table t1 (a varchar(2048), key `a` (a) key_block_size=1000000000000000000) ENGINE=MyISAM;
 
978
show create table t1;
 
979
drop table t1;
 
980
 
 
981
create temporary table t1 (a int not null, key `a` (a) key_block_size=1025) ENGINE=MyISAM;
 
982
show create table t1;
 
983
drop table t1;
 
984
 
 
985
--error 1064
 
986
create temporary table t1 (a int not null, key key_block_size=1024 (a)) ENGINE=MyISAM;
 
987
--error 1064
 
988
create temporary table t1 (a int not null, key `a` key_block_size=1024 (a)) ENGINE=MyISAM;
 
989
 
 
990
#
902
991
# Bug#22119 - Changing MI_KEY_BLOCK_LENGTH makes a wrong myisamchk
903
992
#
904
993
CREATE temporary TABLE t1 (