~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to tests/r/innodb_mysql.result

  • Committer: Padraig O'Sullivan
  • Date: 2009-03-24 15:33:01 UTC
  • mto: (968.2.18 mordred)
  • mto: This revision was merged to the branch mainline in revision 971.
  • Revision ID: osullivan.padraig@gmail.com-20090324153301-90gw63j1lsie1k9j
Removing a very mis-leading comment from sql_locale.cc

The comment was totally wrong and read "This file is build from
my_locale.pl"

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