~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to tests/r/innodb_mysql.result

  • Committer: Brian Aker
  • Date: 2009-01-09 22:07:54 UTC
  • Revision ID: brian@tangent.org-20090109220754-1y50h7lqi9i1ifcs
Dead test/wrong test.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
set global innodb_support_xa=default;
 
2
set session innodb_support_xa=default;
2
3
SET SESSION STORAGE_ENGINE = InnoDB;
3
 
SET @orig_lock_wait_timeout= @@innodb_lock_wait_timeout;
4
 
SET GLOBAL innodb_lock_wait_timeout=2;
5
4
drop table if exists t1,t2,t3,t1m,t1i,t2m,t2i,t4;
6
5
create table t1 (
7
6
c_id int not null default '0',
144
143
CREATE TABLE t1 (
145
144
a1 decimal(10,0) DEFAULT NULL,
146
145
a2 blob,
 
146
a3 time DEFAULT NULL,
147
147
a4 blob,
148
148
a5 char(175) DEFAULT NULL,
149
 
a6 timestamp NOT NULL DEFAULT NOW(),
 
149
a6 timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
150
150
a7 blob,
151
151
INDEX idx (a6,a7(239),a5)
152
152
) ENGINE=InnoDB;
161
161
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
162
162
1       SIMPLE  NULL    NULL    NULL    NULL    NULL    NULL    NULL    Impossible WHERE noticed after reading const tables
163
163
DROP TABLE t1;
164
 
create temporary table t1m (a int) engine = MEMORY;
 
164
create table t1m (a int) engine = MEMORY;
165
165
create table t1i (a int);
166
 
create temporary table t2m (a int) engine = MEMORY;
 
166
create table t2m (a int) engine = MEMORY;
167
167
create table t2i (a int);
168
168
insert into t2m values (5);
169
169
insert into t2i values (5);
213
213
count(*)        min(7)  max(7)
214
214
0       NULL    NULL
215
215
drop table t1m, t1i, t2m, t2i;
216
 
create TEMPORARY table t1 (
 
216
create table t1 (
217
217
a1 char(64), a2 char(64), b char(16), c char(16) not null, d char(16), dummy char(64) default ' '
218
218
) ENGINE = MEMORY;
219
219
insert into t1 (a1, a2, b, c, d) values
316
316
WHERE t1.name LIKE 'A%';
317
317
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
318
318
1       SIMPLE  t1      index   PRIMARY,name    PRIMARY 4       NULL    3       Using where
319
 
1       SIMPLE  t2      ref     fkey    fkey    5       test.t1.id      1       Using where; Using index
 
319
1       SIMPLE  t2      ref     fkey    fkey    5       test.t1.id      1       Using index
320
320
EXPLAIN
321
321
SELECT COUNT(*) FROM t2 LEFT JOIN t1 ON t2.fkey = t1.id
322
322
WHERE t1.name LIKE 'A%' OR FALSE;
347
347
DELETE FROM t1;
348
348
EXPLAIN SELECT DISTINCT t1.name, t1.dept FROM t1 WHERE t1.name='rs5';
349
349
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
350
 
1       SIMPLE  t1      range   name    name    164     NULL    #       Using where; Using index for group-by
 
350
1       SIMPLE  t1      range   name    name    164     NULL    2       Using where; Using index for group-by
351
351
SELECT DISTINCT t1.name, t1.dept FROM t1 WHERE t1.name='rs5';
352
352
name    dept
353
353
DROP TABLE t1;
354
354
drop table if exists t1;
 
355
show variables like 'innodb_rollback_on_timeout';
 
356
Variable_name   Value
 
357
innodb_rollback_on_timeout      OFF
355
358
create table t1 (a int not null primary key) engine = innodb;
356
359
insert into t1 values (1);
357
360
commit;
406
409
tes     1234
407
410
drop table test;
408
411
drop table if exists t1;
 
412
show variables like 'innodb_rollback_on_timeout';
 
413
Variable_name   Value
 
414
innodb_rollback_on_timeout      OFF
409
415
create table t1 (a int not null primary key) engine = innodb;
410
416
insert into t1 values (1);
411
417
commit;
479
485
4       a       2
480
486
drop table t1;
481
487
create table t1(a int) engine=innodb;
482
 
alter table t1 comment='123';
 
488
alter table t1 comment '123';
483
489
show create table t1;
484
490
Table   Create Table
485
491
t1      CREATE TABLE `t1` (
486
 
  `a` INT DEFAULT NULL
487
 
) ENGINE=InnoDB COMMENT='123' COLLATE = utf8_general_ci
 
492
  `a` int
 
493
) ENGINE=InnoDB COMMENT='123'
488
494
drop table t1;
489
495
CREATE TABLE t1 (a CHAR(2), KEY (a)) ENGINE = InnoDB;
490
496
INSERT INTO t1 VALUES ('uk'),('bg');
509
515
UPDATE t2 SET a = 'us' WHERE a = 'uk';
510
516
SELECT * FROM t2 WHERE a = 'uk';
511
517
a
512
 
CREATE TEMPORARY TABLE t3 (a CHAR(2), KEY (a)) ENGINE = MyISAM;
 
518
CREATE TABLE t3 (a CHAR(2), KEY (a)) ENGINE = MyISAM;
513
519
INSERT INTO t3 VALUES ('uk'),('bg');
514
520
SELECT * FROM t3 WHERE a = 'uk';
515
521
a
522
528
SELECT * FROM t3 WHERE a = 'uk';
523
529
a
524
530
DROP TABLE t1,t2,t3;
 
531
CREATE TABLE t1 (a INT) ENGINE=InnoDB;
 
532
CREATE TABLE t2 (a INT) ENGINE=InnoDB;
 
533
switch to connection c1
 
534
SET AUTOCOMMIT=0;
 
535
INSERT INTO t2 VALUES (1);
 
536
switch to connection c2
 
537
SET AUTOCOMMIT=0;
 
538
LOCK TABLES t1 READ, t2 READ;
 
539
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
 
540
switch to connection c1
 
541
COMMIT;
 
542
INSERT INTO t1 VALUES (1);
 
543
switch to connection default
 
544
SET AUTOCOMMIT=default;
 
545
DROP TABLE t1,t2;
525
546
CREATE TABLE t1 (
526
547
id int NOT NULL auto_increment PRIMARY KEY,
527
548
b int NOT NULL,
532
553
CREATE TABLE t2 (
533
554
b int NOT NULL auto_increment PRIMARY KEY,
534
555
c datetime NOT NULL
535
 
) ENGINE= InnoDB;
 
556
) ENGINE= MyISAM;
536
557
INSERT INTO t2(c) VALUES ('2007-01-01');
537
558
INSERT INTO t2(c) SELECT c FROM t2;
538
559
INSERT INTO t2(c) SELECT c FROM t2;
551
572
INSERT INTO t1(b,c) SELECT b,c FROM t2;
552
573
set @@sort_buffer_size=8192;
553
574
Warnings:
554
 
Error   1292    Truncated incorrect sort_buffer_size value: '8192'
 
575
Warning 1292    Truncated incorrect sort_buffer_size value: '8192'
555
576
SELECT COUNT(*) FROM t1;
556
577
COUNT(*)
557
578
3072
634
655
drop table t1,t2;
635
656
create table t1(f1 varchar(800) not null, key(f1));
636
657
Warnings:
637
 
Warning 1071    Specified key was too long; max key length is 1023 bytes
 
658
Warning 1071    Specified key was too long; max key length is 767 bytes
638
659
insert into t1 values('aaa');
639
660
drop table t1;
640
661
CREATE TABLE t1 (a INT PRIMARY KEY, b INT, c FLOAT, KEY b(b)) ENGINE = INNODB;
654
675
1       SIMPLE  t1      ALL     NULL    NULL    NULL    NULL    128     Using filesort
655
676
DROP TABLE t1;
656
677
drop table if exists t1;
 
678
show variables like 'innodb_rollback_on_timeout';
 
679
Variable_name   Value
 
680
innodb_rollback_on_timeout      OFF
657
681
create table t1 (a int not null primary key) engine = innodb;
658
682
insert into t1 values (1);
659
683
commit;
687
711
2
688
712
5
689
713
drop table t1;
 
714
drop table if exists t1;
 
715
create table t1 (a int) engine=innodb;
 
716
alter table t1 alter a set default 1;
 
717
drop table t1;
 
718
 
 
719
Bug#24918 drop table and lock / inconsistent between 
 
720
perm and temp tables
 
721
 
 
722
Check transactional tables under LOCK TABLES
 
723
 
 
724
drop table if exists t24918, t24918_tmp, t24918_trans, t24918_trans_tmp, 
 
725
t24918_access;
 
726
create table t24918_access (id int);
 
727
create table t24918 (id int) engine=myisam;
 
728
create temporary table t24918_tmp (id int) engine=myisam;
 
729
create table t24918_trans (id int) engine=innodb;
 
730
create temporary table t24918_trans_tmp (id int) engine=innodb;
 
731
lock table t24918 write, t24918_tmp write, t24918_trans write, t24918_trans_tmp write;
 
732
drop table t24918;
 
733
select * from t24918_access;
 
734
ERROR HY000: Table 't24918_access' was not locked with LOCK TABLES
 
735
drop table t24918_trans;
 
736
select * from t24918_access;
 
737
ERROR HY000: Table 't24918_access' was not locked with LOCK TABLES
 
738
drop table t24918_trans_tmp;
 
739
select * from t24918_access;
 
740
ERROR HY000: Table 't24918_access' was not locked with LOCK TABLES
 
741
drop table t24918_tmp;
 
742
select * from t24918_access;
 
743
ERROR HY000: Table 't24918_access' was not locked with LOCK TABLES
 
744
unlock tables;
 
745
drop table t24918_access;
690
746
CREATE TABLE t1 (a int, b int, PRIMARY KEY (a), KEY bkey (b)) ENGINE=InnoDB;
691
747
INSERT INTO t1 VALUES (1,2),(3,2),(2,2),(4,2),(5,2),(6,2),(7,2),(8,2);
692
748
INSERT INTO t1 SELECT a + 8, 2 FROM t1;
769
825
id      1
770
826
select_type     SIMPLE
771
827
table   t1
772
 
type    index
 
828
type    range
773
829
possible_keys   bkey
774
830
key     bkey
775
831
key_len 5
776
832
ref     NULL
777
 
rows    32
 
833
rows    16
778
834
Extra   Using where; Using index
779
835
SELECT * FROM t1 WHERE b BETWEEN 1 AND 2 ORDER BY b,a;
780
836
a       b
853
909
key     bkey
854
910
key_len 10
855
911
ref     const,const
856
 
rows    16
 
912
rows    8
857
913
Extra   Using where; Using index
858
914
SELECT * FROM t2 WHERE b=1 AND c=1 ORDER BY a;
859
915
a       b       c
882
938
key     bkey
883
939
key_len 10
884
940
ref     const,const
885
 
rows    16
 
941
rows    8
886
942
Extra   Using where; Using index
887
943
SELECT * FROM t2 WHERE b=1 AND c=1 ORDER BY b,c,a;
888
944
a       b       c
911
967
key     bkey
912
968
key_len 10
913
969
ref     const,const
914
 
rows    16
 
970
rows    8
915
971
Extra   Using where; Using index
916
972
SELECT * FROM t2 WHERE b=1 AND c=1 ORDER BY c,a;
917
973
a       b       c
936
992
insert into t1 values('aaa');
937
993
alter table t1 add index(a(1024));
938
994
Warnings:
939
 
Warning 1071    Specified key was too long; max key length is 1023 bytes
 
995
Warning 1071    Specified key was too long; max key length is 767 bytes
 
996
Warning 1071    Specified key was too long; max key length is 767 bytes
 
997
Warning 1071    Specified key was too long; max key length is 767 bytes
940
998
show create table t1;
941
999
Table   Create Table
942
1000
t1      CREATE TABLE `t1` (
943
 
  `a` TEXT COLLATE utf8_general_ci,
944
 
  KEY `a` (`a`(255))
945
 
) ENGINE=InnoDB COLLATE = utf8_general_ci
 
1001
  `a` text,
 
1002
  KEY `a` (`a`())
 
1003
) ENGINE=InnoDB
946
1004
drop table t1;
947
1005
CREATE TABLE t1 (
948
1006
a INT,
1022
1080
key     b
1023
1081
key_len 5
1024
1082
ref     const
1025
 
rows    2
 
1083
rows    1
1026
1084
Extra   Using where; Using index
1027
1085
SELECT * FROM t1 WHERE b=2 ORDER BY a ASC;
1028
1086
a       b
1037
1095
key     b
1038
1096
key_len 5
1039
1097
ref     const
1040
 
rows    2
 
1098
rows    1
1041
1099
Extra   Using where; Using index
1042
1100
SELECT * FROM t1 WHERE b=2 ORDER BY a DESC;
1043
1101
a       b
1124
1182
# - initial check;
1125
1183
 
1126
1184
SELECT table_schema, table_name, row_format
1127
 
FROM data_dictionary.TABLES
 
1185
FROM INFORMATION_SCHEMA.TABLES
1128
1186
WHERE table_schema = DATABASE() AND table_name = 't1';
1129
1187
table_schema    table_name      row_format
1130
 
test    t1      DEFAULT
 
1188
test    t1      Compact
1131
1189
 
1132
1190
# - change ROW_FORMAT and check;
1133
1191
 
1134
1192
ALTER TABLE t1 ROW_FORMAT = REDUNDANT;
1135
1193
 
1136
1194
SELECT table_schema, table_name, row_format
1137
 
FROM data_dictionary.TABLES
 
1195
FROM INFORMATION_SCHEMA.TABLES
1138
1196
WHERE table_schema = DATABASE() AND table_name = 't1';
1139
1197
table_schema    table_name      row_format
1140
 
test    t1      DEFAULT
 
1198
test    t1      Redundant
1141
1199
 
1142
1200
# - that's it, cleanup.
1143
1201
 
1145
1203
create table t1(a char(10) not null, unique key aa(a(1)),
1146
1204
b char(4) not null, unique key bb(b(4))) engine=innodb;
1147
1205
desc t1;
1148
 
Field   Type    Null    Default Default_is_NULL On_Update
1149
 
a       VARCHAR NO              NO      
1150
 
b       VARCHAR NO              NO      
 
1206
Field   Type    Null    Key     Default Extra
 
1207
a       varchar(10)     NO      UNI     NULL    
 
1208
b       varchar(4)      NO      PRI     NULL    
1151
1209
show create table t1;
1152
1210
Table   Create Table
1153
1211
t1      CREATE TABLE `t1` (
1154
 
  `a` VARCHAR(10) COLLATE utf8_general_ci NOT NULL,
1155
 
  `b` VARCHAR(4) COLLATE utf8_general_ci NOT NULL,
 
1212
  `a` varchar(10) NOT NULL,
 
1213
  `b` varchar(4) NOT NULL,
1156
1214
  UNIQUE KEY `bb` (`b`),
1157
 
  UNIQUE KEY `aa` (`a`(1))
1158
 
) ENGINE=InnoDB COLLATE = utf8_general_ci
 
1215
  UNIQUE KEY `aa` (`a`())
 
1216
) ENGINE=InnoDB
1159
1217
drop table t1;
1160
1218
CREATE TABLE t1 (id int, type char(6), d int, INDEX idx(id,d)) ENGINE=InnoDB;
1161
1219
INSERT INTO t1 VALUES 
1172
1230
set @my_innodb_autoextend_increment=@@global.innodb_autoextend_increment;
1173
1231
set global innodb_autoextend_increment=8;
1174
1232
set global innodb_autoextend_increment=@my_innodb_autoextend_increment;
 
1233
set @my_innodb_commit_concurrency=@@global.innodb_commit_concurrency;
 
1234
set global innodb_commit_concurrency=0;
 
1235
set global innodb_commit_concurrency=@my_innodb_commit_concurrency;
1175
1236
End of 5.0 tests
1176
1237
CREATE TABLE `t2` (
1177
1238
`k` int NOT NULL auto_increment,
1241
1302
11      15      1
1242
1303
12      20      1
1243
1304
drop table t2;
 
1305
drop table if exists t1, t2;
 
1306
create table t1 (i int);
 
1307
alter table t1 modify i int default 1;
 
1308
alter table t1 modify i int default 2, rename t2;
 
1309
lock table t2 write;
 
1310
alter table t2 modify i int default 3;
 
1311
unlock tables;
 
1312
lock table t2 write;
 
1313
alter table t2 modify i int default 4, rename t1;
 
1314
unlock tables;
 
1315
drop table t1;
 
1316
drop table if exists t1;
 
1317
create table t1 (i int);
 
1318
insert into t1 values ();
 
1319
lock table t1 write;
 
1320
alter table t1 modify i int default 1;
 
1321
insert into t1 values ();
 
1322
select * from t1;
 
1323
i
 
1324
NULL
 
1325
1
 
1326
alter table t1 change i c char(10) default "Two";
 
1327
insert into t1 values ();
 
1328
select * from t1;
 
1329
c
 
1330
NULL
 
1331
1
 
1332
Two
 
1333
unlock tables;
 
1334
select * from t1;
 
1335
c
 
1336
NULL
 
1337
1
 
1338
Two
 
1339
drop tables t1;
1244
1340
create table t1(f1 varchar(5) unique, f2 timestamp NOT NULL DEFAULT
1245
1341
CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP);
1246
1342
insert into t1(f1) values(1);
1272
1368
CREATE TABLE t1 (a INT NOT NULL, b INT NOT NULL, PRIMARY KEY (a,b)) engine=innodb;
1273
1369
CREATE TABLE t2 (c INT NOT NULL, d INT NOT NULL, PRIMARY KEY (c,d),
1274
1370
CONSTRAINT c2 FOREIGN KEY f2 (c) REFERENCES t1 (a,b) ON UPDATE NO ACTION) engine=innodb;
1275
 
ERROR 42000: Incorrect foreign key definition for 'c2': Key reference and table reference don't match
 
1371
ERROR 42000: Incorrect foreign key definition for 'f2': Key reference and table reference don't match
1276
1372
CREATE TABLE t2 (c INT NOT NULL, d INT NOT NULL, PRIMARY KEY (c,d),
1277
1373
CONSTRAINT c2 FOREIGN KEY (c) REFERENCES t1 (a,b) ON UPDATE NO ACTION) engine=innodb;
1278
1374
ERROR 42000: Incorrect foreign key definition for 'c2': Key reference and table reference don't match
1295
1391
SHOW CREATE TABLE t2;
1296
1392
Table   Create Table
1297
1393
t2      CREATE TABLE `t2` (
1298
 
  `c` INT NOT NULL,
1299
 
  `d` INT NOT NULL,
 
1394
  `c` int NOT NULL,
 
1395
  `d` int NOT NULL,
1300
1396
  PRIMARY KEY (`c`,`d`),
1301
1397
  CONSTRAINT `c1` FOREIGN KEY (`c`) REFERENCES `t1` (`a`) ON DELETE NO ACTION,
1302
1398
  CONSTRAINT `c2` FOREIGN KEY (`c`) REFERENCES `t1` (`a`) ON UPDATE NO ACTION,
1303
 
  CONSTRAINT `f3` FOREIGN KEY (`c`) REFERENCES `t1` (`a`) ON UPDATE NO ACTION,
1304
 
  CONSTRAINT `t2_ibfk_4` FOREIGN KEY (`c`) REFERENCES `t1` (`a`) ON UPDATE NO ACTION
1305
 
) ENGINE=InnoDB COLLATE = utf8_general_ci
 
1399
  CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`c`) REFERENCES `t1` (`a`) ON UPDATE NO ACTION,
 
1400
  CONSTRAINT `t2_ibfk_2` FOREIGN KEY (`c`) REFERENCES `t1` (`a`) ON UPDATE NO ACTION
 
1401
) ENGINE=InnoDB
1306
1402
DROP TABLE t2;
1307
1403
DROP TABLE t1;
1308
1404
create table t1 (a int auto_increment primary key) engine=innodb;
1347
1443
 
1348
1444
DROP TABLE t2;
1349
1445
DROP TABLE t1;
1350
 
SET GLOBAL innodb_lock_wait_timeout=@orig_lock_wait_timeout ;
1351
1446
End of 5.1 tests
1352
 
#
1353
 
# Test for bug #39932 "create table fails if column for FK is in different
1354
 
#                      case than in corr index".
1355
 
#
1356
 
drop tables if exists t1, t2;
1357
 
create table t1 (pk int primary key) engine=InnoDB;
1358
 
# Even although the below statement uses uppercased field names in
1359
 
# foreign key definition it still should be able to find explicitly
1360
 
# created supporting index. So it should succeed and should not
1361
 
# create any additional supporting indexes.
1362
 
create table t2 (fk int, key x (fk),
1363
 
constraint x foreign key (FK) references t1 (PK)) engine=InnoDB;
1364
 
show create table t2;
1365
 
Table   Create Table
1366
 
t2      CREATE TABLE `t2` (
1367
 
  `fk` INT DEFAULT NULL,
1368
 
  KEY `x` (`fk`),
1369
 
  CONSTRAINT `x` FOREIGN KEY (`FK`) REFERENCES `t1` (`PK`)
1370
 
) ENGINE=InnoDB COLLATE = utf8_general_ci
1371
 
drop table t2, t1;
1372
 
#
1373
 
# Bug#55826: create table .. select crashes with when KILL_BAD_DATA 
1374
 
#  is returned
1375
 
#
1376
 
CREATE TABLE t1(a INT) ENGINE=innodb;
1377
 
INSERT INTO t1 VALUES (0);
1378
 
CREATE TABLE t2 
1379
 
SELECT LEAST((SELECT '' FROM t1),NOW()) FROM `t1`;
1380
 
ERROR 22007: Incorrect datetime value: '' for column 'NOW()' at row 1
1381
 
DROP TABLE IF EXISTS t1,t2;
1382
 
Warnings:
1383
 
Note    1051    Unknown table 't2'