~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to tests/r/innodb.result

  • Committer: Padraig O'Sullivan
  • Date: 2009-12-17 04:48:59 UTC
  • mto: This revision was merged to the branch mainline in revision 1246.
  • Revision ID: osullivan.padraig@gmail.com-20091217044859-qorpkp4911zypfv3
Added some dtrace probes for tracing the optimizer.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
SET @orig_lock_wait_timeout= @@innodb_lock_wait_timeout;
2
 
SET GLOBAL innodb_lock_wait_timeout=2;
3
1
drop table if exists t1,t2,t3,t4;
4
2
drop database if exists mysqltest;
5
3
create table t1 (id int not null auto_increment, code int not null, name char(20) not null, primary key (id), key (code), unique (name)) engine=innodb;
168
166
1       1007    101
169
167
alter table t1 ENGINE=innodb;
170
168
show keys from t1;
171
 
Table   Unique  Key_name        Seq_in_index    Column_name
172
 
t1      YES     PRIMARY 1       id
173
 
t1      NO      parent_id       1       parent_id
174
 
t1      NO      level   1       level
 
169
Table   Non_unique      Key_name        Seq_in_index    Column_name     Collation       Cardinality     Sub_part        Packed  Null    Index_type      Comment Index_Comment
 
170
t1      0       PRIMARY 1       id      A       #       NULL    NULL            BTREE           
 
171
t1      1       parent_id       1       parent_id       A       #       NULL    NULL            BTREE           
 
172
t1      1       level   1       level   A       #       NULL    NULL            BTREE           
175
173
drop table t1;
176
174
CREATE TABLE t1 (
177
175
gesuchnr int DEFAULT '0' NOT NULL,
209
207
Table   Op      Msg_type        Msg_text
210
208
test.t1 analyze status  OK
211
209
show keys from t1;
212
 
Table   Unique  Key_name        Seq_in_index    Column_name
213
 
t1      NO      skr     1       a
 
210
Table   Non_unique      Key_name        Seq_in_index    Column_name     Collation       Cardinality     Sub_part        Packed  Null    Index_type      Comment Index_Comment
 
211
t1      1       skr     1       a       A       #       NULL    NULL    YES     BTREE           
214
212
drop table t1;
215
213
create table t1 (a int,b varchar(20),key(a)) engine=innodb;
216
214
insert into t1 values (1,""), (2,"testing");
275
273
rollback to savepoint `my_savepoint`;
276
274
ERROR 42000: SAVEPOINT my_savepoint does not exist
277
275
rollback to savepoint savept2;
 
276
ERROR 42000: SAVEPOINT savept2 does not exist
278
277
insert into t1 values (8);
279
278
savepoint sv;
280
279
commit;
331
330
commit;
332
331
select * from t1;
333
332
id      val
334
 
commit;
335
333
drop table t1;
336
334
create table t1 (a integer) engine=innodb;
 
335
start transaction;
337
336
rename table t1 to t2;
338
337
create table t1 (b integer) engine=innodb;
339
 
start transaction;
340
338
insert into t1 values (1);
341
339
rollback;
342
340
drop table t1;
359
357
SELECT _userid FROM t1 WHERE _userid='marc@anyware.co.uk';
360
358
_userid
361
359
marc@anyware.co.uk
362
 
COMMIT;
363
360
drop table t1;
364
361
set autocommit=1;
365
362
CREATE TABLE t1 (
398
395
CREATE TABLE t1 (a int not null, b int not null,c int not null,
399
396
key(a),primary key(a,b), unique(c),key(a),unique(b));
400
397
show index from t1;
401
 
Table   Unique  Key_name        Seq_in_index    Column_name
402
 
t1      YES     PRIMARY 1       a
403
 
t1      YES     PRIMARY 2       b
404
 
t1      YES     c       1       c
405
 
t1      YES     b       1       b
406
 
t1      NO      a       1       a
407
 
t1      NO      a_2     1       a
 
398
Table   Non_unique      Key_name        Seq_in_index    Column_name     Collation       Cardinality     Sub_part        Packed  Null    Index_type      Comment Index_Comment
 
399
t1      0       PRIMARY 1       a       A       #       NULL    NULL            BTREE           
 
400
t1      0       PRIMARY 2       b       A       #       NULL    NULL            BTREE           
 
401
t1      0       c       1       c       A       #       NULL    NULL            BTREE           
 
402
t1      0       b       1       b       A       #       NULL    NULL            BTREE           
 
403
t1      1       a       1       a       A       #       NULL    NULL            BTREE           
 
404
t1      1       a_2     1       a       A       #       NULL    NULL            BTREE           
408
405
drop table t1;
409
406
create table t1 (col1 int not null, col2 char(4) not null, primary key(col1));
410
407
alter table t1 engine=innodb;
424
421
3       4
425
422
4       7
426
423
5       2
427
 
ALTER TABLE t1 ADD co3 INT DEFAULT 42 NOT NULL;
 
424
alter table t1 add co3 int not null;
428
425
select * from t1;
429
426
col1    col2    co3
430
 
1       1       42
431
 
2       3       42
432
 
3       4       42
433
 
4       7       42
434
 
5       2       42
 
427
1       1       0
 
428
2       3       0
 
429
3       4       0
 
430
4       7       0
 
431
5       2       0
435
432
update t1 set col2='9' where col1='2';
436
433
select * from t1;
437
434
col1    col2    co3
438
 
1       1       42
439
 
2       9       42
440
 
3       4       42
441
 
4       7       42
442
 
5       2       42
 
435
1       1       0
 
436
2       9       0
 
437
3       4       0
 
438
4       7       0
 
439
5       2       0
443
440
drop table t1;
444
441
create table t1 (a int not null , b int, primary key (a)) engine = innodb;
445
442
create TEMPORARY table t2 (a int not null , b int, primary key (a)) engine = myisam;
736
733
hello   1
737
734
alter table t1 engine=innodb;
738
735
show keys from t1;
739
 
Table   Unique  Key_name        Seq_in_index    Column_name
740
 
t1      YES     PRIMARY 1       a
 
736
Table   Non_unique      Key_name        Seq_in_index    Column_name     Collation       Cardinality     Sub_part        Packed  Null    Index_type      Comment Index_Comment
 
737
t1      0       PRIMARY 1       a       A       #       NULL    NULL            BTREE           
741
738
drop table t1;
742
739
create table t1 (i int, j int ) ENGINE=innodb;
743
740
insert into t1 values (1,2);
777
774
show create table t1;
778
775
Table   Create Table
779
776
t1      CREATE TABLE `t1` (
780
 
  `a` VARCHAR(20) COLLATE utf8_general_ci DEFAULT NULL,
 
777
  `a` varchar(20) DEFAULT NULL,
781
778
  KEY `a` (`a`(5))
782
 
) ENGINE=InnoDB COLLATE = utf8_general_ci
 
779
) ENGINE=InnoDB
783
780
drop table t1;
784
781
create temporary table t1 (a int not null auto_increment, primary key(a)) engine=innodb;
785
782
insert into t1 values (NULL),(NULL),(NULL);
827
824
commit;
828
825
drop database mysqltest;
829
826
show tables from mysqltest;
830
 
ERROR 42000: Unknown schema 'mysqltest'
 
827
ERROR 42000: Unknown database 'mysqltest'
831
828
set autocommit=0;
832
829
create table t1 (a int not null) engine= innodb;
833
830
insert into t1 values(1),(2);
834
 
commit;
835
831
truncate table t1;
836
832
commit;
837
833
truncate table t1;
888
884
drop table t1;
889
885
create table t1 (t int not null default 1, key (t)) engine=innodb;
890
886
desc t1;
891
 
Field   Type    Null    Default Default_is_NULL On_Update
892
 
t       INTEGER NO      1       NO      
 
887
Field   Type    Null    Key     Default Extra
 
888
t       int     NO      MUL     1       
893
889
drop table t1;
894
890
create table t1 (id int not null auto_increment, code int not null, name char(20) not null, primary key (id), key (code), unique (name)) engine=innodb;
895
891
BEGIN;
1132
1128
insert t1 values (1, "aaa", "bbb"), (NULL, "", "ccccc"), (0, NULL, "");
1133
1129
insert t2 select * from t1;
1134
1130
insert t3 select * from t1;
 
1131
checksum table t1, t2, t3, t4;
 
1132
Table   Checksum
 
1133
test.t1 2948697075
 
1134
test.t2 2948697075
 
1135
test.t3 2948697075
 
1136
test.t4 NULL
 
1137
Warnings:
 
1138
Error   1146    Table 'test.t4' doesn't exist
 
1139
checksum table t1, t2, t3, t4;
 
1140
Table   Checksum
 
1141
test.t1 2948697075
 
1142
test.t2 2948697075
 
1143
test.t3 2948697075
 
1144
test.t4 NULL
 
1145
Warnings:
 
1146
Error   1146    Table 'test.t4' doesn't exist
 
1147
checksum table t1, t2, t3, t4;
 
1148
Table   Checksum
 
1149
test.t1 2948697075
 
1150
test.t2 2948697075
 
1151
test.t3 2948697075
 
1152
test.t4 NULL
 
1153
Warnings:
 
1154
Error   1146    Table 'test.t4' doesn't exist
1135
1155
drop table t1,t2,t3;
1136
1156
create table t1 (id int,  name char(10) not null,  name2 char(10) not null) engine=innodb;
1137
1157
insert into t1 values(1,'first','fff'),(2,'second','sss'),(3,'third','ttt');
1155
1175
show create table t1;
1156
1176
Table   Create Table
1157
1177
t1      CREATE TABLE `t1` (
1158
 
  `id` INT NOT NULL,
1159
 
  `id2` INT NOT NULL,
 
1178
  `id` int NOT NULL,
 
1179
  `id2` int NOT NULL,
1160
1180
  UNIQUE KEY `id` (`id`,`id2`)
1161
 
) ENGINE=InnoDB COLLATE = utf8_general_ci
 
1181
) ENGINE=InnoDB
1162
1182
show create table t2;
1163
1183
Table   Create Table
1164
1184
t2      CREATE TABLE `t2` (
1165
 
  `id` INT NOT NULL,
 
1185
  `id` int NOT NULL,
1166
1186
  KEY `t1_id_fk` (`id`),
1167
1187
  CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`) REFERENCES `t1` (`id`)
1168
 
) ENGINE=InnoDB COLLATE = utf8_general_ci
 
1188
) ENGINE=InnoDB
1169
1189
create index id on t2 (id);
1170
1190
show create table t2;
1171
1191
Table   Create Table
1172
1192
t2      CREATE TABLE `t2` (
1173
 
  `id` INT NOT NULL,
 
1193
  `id` int NOT NULL,
1174
1194
  KEY `id` (`id`),
1175
1195
  CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`) REFERENCES `t1` (`id`)
1176
 
) ENGINE=InnoDB COLLATE = utf8_general_ci
 
1196
) ENGINE=InnoDB
1177
1197
create index id2 on t2 (id);
1178
1198
show create table t2;
1179
1199
Table   Create Table
1180
1200
t2      CREATE TABLE `t2` (
1181
 
  `id` INT NOT NULL,
 
1201
  `id` int NOT NULL,
1182
1202
  KEY `id` (`id`),
1183
1203
  KEY `id2` (`id`),
1184
1204
  CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`) REFERENCES `t1` (`id`)
1185
 
) ENGINE=InnoDB COLLATE = utf8_general_ci
 
1205
) ENGINE=InnoDB
1186
1206
drop index id2 on t2;
1187
1207
drop index id on t2;
1188
1208
Got one of the listed errors
1189
1209
show create table t2;
1190
1210
Table   Create Table
1191
1211
t2      CREATE TABLE `t2` (
1192
 
  `id` INT NOT NULL,
 
1212
  `id` int NOT NULL,
1193
1213
  KEY `id` (`id`),
1194
1214
  CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`) REFERENCES `t1` (`id`)
1195
 
) ENGINE=InnoDB COLLATE = utf8_general_ci
 
1215
) ENGINE=InnoDB
1196
1216
drop table t2;
1197
1217
create table t2 (id int not null, id2 int not null, constraint t1_id_fk foreign key (id,id2) references t1 (id,id2)) engine = innodb;
1198
1218
show create table t2;
1199
1219
Table   Create Table
1200
1220
t2      CREATE TABLE `t2` (
1201
 
  `id` INT NOT NULL,
1202
 
  `id2` INT NOT NULL,
 
1221
  `id` int NOT NULL,
 
1222
  `id2` int NOT NULL,
1203
1223
  KEY `t1_id_fk` (`id`,`id2`),
1204
1224
  CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`, `id2`) REFERENCES `t1` (`id`, `id2`)
1205
 
) ENGINE=InnoDB COLLATE = utf8_general_ci
 
1225
) ENGINE=InnoDB
1206
1226
create unique index id on t2 (id,id2);
1207
1227
show create table t2;
1208
1228
Table   Create Table
1209
1229
t2      CREATE TABLE `t2` (
1210
 
  `id` INT NOT NULL,
1211
 
  `id2` INT NOT NULL,
 
1230
  `id` int NOT NULL,
 
1231
  `id2` int NOT NULL,
1212
1232
  UNIQUE KEY `id` (`id`,`id2`),
1213
1233
  CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`, `id2`) REFERENCES `t1` (`id`, `id2`)
1214
 
) ENGINE=InnoDB COLLATE = utf8_general_ci
 
1234
) ENGINE=InnoDB
1215
1235
drop table t2;
1216
1236
create table t2 (id int not null, id2 int not null, unique (id,id2),constraint t1_id_fk foreign key (id2,id) references t1 (id,id2)) engine = innodb;
1217
1237
show create table t2;
1218
1238
Table   Create Table
1219
1239
t2      CREATE TABLE `t2` (
1220
 
  `id` INT NOT NULL,
1221
 
  `id2` INT NOT NULL,
 
1240
  `id` int NOT NULL,
 
1241
  `id2` int NOT NULL,
1222
1242
  UNIQUE KEY `id` (`id`,`id2`),
1223
1243
  KEY `t1_id_fk` (`id2`,`id`),
1224
1244
  CONSTRAINT `t1_id_fk` FOREIGN KEY (`id2`, `id`) REFERENCES `t1` (`id`, `id2`)
1225
 
) ENGINE=InnoDB COLLATE = utf8_general_ci
 
1245
) ENGINE=InnoDB
1226
1246
drop table t2;
1227
1247
create table t2 (id int not null, id2 int not null, unique (id,id2), constraint t1_id_fk foreign key (id) references t1 (id)) engine = innodb;
1228
1248
show create table t2;
1229
1249
Table   Create Table
1230
1250
t2      CREATE TABLE `t2` (
1231
 
  `id` INT NOT NULL,
1232
 
  `id2` INT NOT NULL,
 
1251
  `id` int NOT NULL,
 
1252
  `id2` int NOT NULL,
1233
1253
  UNIQUE KEY `id` (`id`,`id2`),
1234
1254
  CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`) REFERENCES `t1` (`id`)
1235
 
) ENGINE=InnoDB COLLATE = utf8_general_ci
 
1255
) ENGINE=InnoDB
1236
1256
drop table t2;
1237
1257
create table t2 (id int not null, id2 int not null, unique (id,id2),constraint t1_id_fk foreign key (id2,id) references t1 (id,id2)) engine = innodb;
1238
1258
show create table t2;
1239
1259
Table   Create Table
1240
1260
t2      CREATE TABLE `t2` (
1241
 
  `id` INT NOT NULL,
1242
 
  `id2` INT NOT NULL,
 
1261
  `id` int NOT NULL,
 
1262
  `id2` int NOT NULL,
1243
1263
  UNIQUE KEY `id` (`id`,`id2`),
1244
1264
  KEY `t1_id_fk` (`id2`,`id`),
1245
1265
  CONSTRAINT `t1_id_fk` FOREIGN KEY (`id2`, `id`) REFERENCES `t1` (`id`, `id2`)
1246
 
) ENGINE=InnoDB COLLATE = utf8_general_ci
 
1266
) ENGINE=InnoDB
1247
1267
drop table t2;
1248
1268
create table t2 (id int not null auto_increment, id2 int not null, constraint t1_id_fk foreign key (id) references t1 (id), primary key (id), index (id,id2)) engine = innodb;
1249
1269
show create table t2;
1250
1270
Table   Create Table
1251
1271
t2      CREATE TABLE `t2` (
1252
 
  `id` INT NOT NULL AUTO_INCREMENT,
1253
 
  `id2` INT NOT NULL,
 
1272
  `id` int NOT NULL AUTO_INCREMENT,
 
1273
  `id2` int NOT NULL,
1254
1274
  PRIMARY KEY (`id`),
1255
1275
  KEY `id` (`id`,`id2`),
1256
1276
  CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`) REFERENCES `t1` (`id`)
1257
 
) ENGINE=InnoDB COLLATE = utf8_general_ci
 
1277
) ENGINE=InnoDB
1258
1278
drop table t2;
1259
1279
create table t2 (id int not null auto_increment, id2 int not null, constraint t1_id_fk foreign key (id) references t1 (id)) engine= innodb;
1260
1280
show create table t2;
1261
1281
Table   Create Table
1262
1282
t2      CREATE TABLE `t2` (
1263
 
  `id` INT NOT NULL AUTO_INCREMENT,
1264
 
  `id2` INT NOT NULL,
 
1283
  `id` int NOT NULL AUTO_INCREMENT,
 
1284
  `id2` int NOT NULL,
1265
1285
  KEY `t1_id_fk` (`id`),
1266
1286
  CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`) REFERENCES `t1` (`id`)
1267
 
) ENGINE=InnoDB COLLATE = utf8_general_ci
 
1287
) ENGINE=InnoDB
1268
1288
alter table t2 add index id_test (id), add index id_test2 (id,id2);
1269
1289
show create table t2;
1270
1290
Table   Create Table
1271
1291
t2      CREATE TABLE `t2` (
1272
 
  `id` INT NOT NULL AUTO_INCREMENT,
1273
 
  `id2` INT NOT NULL,
 
1292
  `id` int NOT NULL AUTO_INCREMENT,
 
1293
  `id2` int NOT NULL,
1274
1294
  KEY `id_test` (`id`),
1275
1295
  KEY `id_test2` (`id`,`id2`),
1276
1296
  CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`) REFERENCES `t1` (`id`)
1277
 
) ENGINE=InnoDB COLLATE = utf8_general_ci
 
1297
) ENGINE=InnoDB
1278
1298
drop table t2;
1279
1299
create table t2 (id int not null, id2 int not null, constraint t1_id_fk foreign key (id2,id) references t1 (id)) engine = innodb;
1280
1300
ERROR 42000: Incorrect foreign key definition for 't1_id_fk': Key reference and table reference don't match
1282
1302
show create table t2;
1283
1303
Table   Create Table
1284
1304
t2      CREATE TABLE `t2` (
1285
 
  `a` INT NOT NULL AUTO_INCREMENT,
1286
 
  `b` INT DEFAULT NULL,
 
1305
  `a` int NOT NULL AUTO_INCREMENT,
 
1306
  `b` int DEFAULT NULL,
1287
1307
  PRIMARY KEY (`a`),
1288
1308
  UNIQUE KEY `b_2` (`b`),
1289
1309
  KEY `b` (`b`),
1290
1310
  CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`b`) REFERENCES `t1` (`id`)
1291
 
) ENGINE=InnoDB COLLATE = utf8_general_ci
 
1311
) ENGINE=InnoDB
1292
1312
drop table t2;
1293
1313
create table t2 (a int auto_increment primary key, b int, foreign key (b) references t1(id), foreign key (b) references t1(id), unique(b)) engine=innodb;
1294
1314
show create table t2;
1295
1315
Table   Create Table
1296
1316
t2      CREATE TABLE `t2` (
1297
 
  `a` INT NOT NULL AUTO_INCREMENT,
1298
 
  `b` INT DEFAULT NULL,
 
1317
  `a` int NOT NULL AUTO_INCREMENT,
 
1318
  `b` int DEFAULT NULL,
1299
1319
  PRIMARY KEY (`a`),
1300
1320
  UNIQUE KEY `b` (`b`),
1301
1321
  CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`b`) REFERENCES `t1` (`id`),
1302
1322
  CONSTRAINT `t2_ibfk_2` FOREIGN KEY (`b`) REFERENCES `t1` (`id`)
1303
 
) ENGINE=InnoDB COLLATE = utf8_general_ci
 
1323
) ENGINE=InnoDB
1304
1324
drop table t2, t1;
1305
1325
create table t1 (c char(10), index (c,c)) engine=innodb;
1306
1326
ERROR 42S21: Duplicate column name 'c'
1397
1417
0
1398
1418
explain select count(*) from t1 where x > -16;
1399
1419
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
1400
 
1       SIMPLE  t1      index   PRIMARY PRIMARY 8       NULL    2       Using where; Using index
 
1420
1       SIMPLE  t1      range   PRIMARY PRIMARY 8       NULL    1       Using where; Using index
1401
1421
select count(*) from t1 where x > -16;
1402
1422
count(*)
1403
1423
2
1409
1429
count(*)
1410
1430
1
1411
1431
drop table t1;
1412
 
show status like "Innodb_buffer_pool_pages_total";
1413
 
Variable_name   Value
1414
 
show status like "Innodb_page_size";
1415
 
Variable_name   Value
1416
 
show status like "Innodb_rows_deleted";
1417
 
Variable_name   Value
1418
 
show status like "Innodb_rows_inserted";
1419
 
Variable_name   Value
1420
 
show status like "Innodb_rows_updated";
1421
 
Variable_name   Value
1422
 
show status like "Innodb_row_lock_waits";
1423
 
Variable_name   Value
1424
 
show status like "Innodb_row_lock_current_waits";
1425
 
Variable_name   Value
1426
 
show status like "Innodb_row_lock_time";
1427
 
Variable_name   Value
1428
 
show status like "Innodb_row_lock_time_max";
1429
 
Variable_name   Value
1430
 
show status like "Innodb_row_lock_time_avg";
1431
 
Variable_name   Value
1432
 
set @my_innodb_sync_spin_loops = @@global.innodb_sync_spin_loops;
1433
1432
show variables like "innodb_sync_spin_loops";
1434
1433
Variable_name   Value
1435
1434
innodb_sync_spin_loops  30
1445
1444
show variables like "innodb_sync_spin_loops";
1446
1445
Variable_name   Value
1447
1446
innodb_sync_spin_loops  20
1448
 
set @@global.innodb_sync_spin_loops = @my_innodb_sync_spin_loops;
1449
 
set @my_innodb_thread_concurrency = @@global.innodb_thread_concurrency;
1450
1447
show variables like "innodb_thread_concurrency";
1451
1448
Variable_name   Value
1452
1449
innodb_thread_concurrency       0
1453
1450
set global innodb_thread_concurrency=1001;
1454
1451
Warnings:
1455
 
Error   1524    Error setting innodb_thread_concurrency. Given value 1001 (> 1000)
 
1452
Error   1292    Truncated incorrect thread_concurrency value: '1001'
1456
1453
show variables like "innodb_thread_concurrency";
1457
1454
Variable_name   Value
1458
 
innodb_thread_concurrency       0
 
1455
innodb_thread_concurrency       1000
1459
1456
set global innodb_thread_concurrency=0;
1460
1457
show variables like "innodb_thread_concurrency";
1461
1458
Variable_name   Value
1464
1461
show variables like "innodb_thread_concurrency";
1465
1462
Variable_name   Value
1466
1463
innodb_thread_concurrency       16
1467
 
set @@global.innodb_thread_concurrency = @my_innodb_thread_concurrency;
1468
1464
show variables like "innodb_concurrency_tickets";
1469
1465
Variable_name   Value
1470
1466
innodb_concurrency_tickets      500
1474
1470
innodb_concurrency_tickets      1000
1475
1471
set global innodb_concurrency_tickets=0;
1476
1472
Warnings:
1477
 
Error   1524    Error setting innodb_concurrency_tickets. Given value 0 (< 1)
 
1473
Error   1292    Truncated incorrect concurrency_tickets value: '0'
1478
1474
show variables like "innodb_concurrency_tickets";
1479
1475
Variable_name   Value
1480
 
innodb_concurrency_tickets      1000
 
1476
innodb_concurrency_tickets      1
1481
1477
set global innodb_concurrency_tickets=500;
1482
1478
show variables like "innodb_concurrency_tickets";
1483
1479
Variable_name   Value
1505
1501
insert into t1 values('+ ', '+ ', '+ ');
1506
1502
set @a=repeat(' ',20);
1507
1503
insert into t1 values (concat('+',@a),concat('+',@a),concat('+',@a));
1508
 
ERROR 22001: Data too long for column 'v' at row 1
1509
 
set @a=repeat(' ',10);
1510
 
insert into t1 values (concat('+',@a),concat('+',@a),concat('+',@a));
1511
 
ERROR 22001: Data too long for column 'v' at row 1
1512
 
set @a=repeat(' ',9);
1513
 
insert into t1 values (concat('+',@a),concat('+',@a),concat('+',@a));
 
1504
Warnings:
 
1505
Note    1265    Data truncated for column 'v' at row 1
 
1506
Note    1265    Data truncated for column 'c' at row 1
1514
1507
select concat('*',v,'*',c,'*',t,'*') from t1;
1515
1508
concat('*',v,'*',c,'*',t,'*')
1516
1509
*+ *+ *+ *
1517
 
*+         *+         *+         *
 
1510
*+         *+         *+                    *
1518
1511
show create table t1;
1519
1512
Table   Create Table
1520
1513
t1      CREATE TABLE `t1` (
1521
 
  `v` VARCHAR(10) COLLATE utf8_general_ci DEFAULT NULL,
1522
 
  `c` VARCHAR(10) COLLATE utf8_general_ci DEFAULT NULL,
1523
 
  `t` TEXT COLLATE utf8_general_ci
1524
 
) ENGINE=InnoDB COLLATE = utf8_general_ci
 
1514
  `v` varchar(10) DEFAULT NULL,
 
1515
  `c` varchar(10) DEFAULT NULL,
 
1516
  `t` text
 
1517
) ENGINE=InnoDB
1525
1518
create  table t2 like t1;
1526
1519
show create table t2;
1527
1520
Table   Create Table
1528
1521
t2      CREATE TABLE `t2` (
1529
 
  `v` VARCHAR(10) COLLATE utf8_general_ci DEFAULT NULL,
1530
 
  `c` VARCHAR(10) COLLATE utf8_general_ci DEFAULT NULL,
1531
 
  `t` TEXT COLLATE utf8_general_ci
1532
 
) ENGINE=InnoDB COLLATE = utf8_general_ci
 
1522
  `v` varchar(10) DEFAULT NULL,
 
1523
  `c` varchar(10) DEFAULT NULL,
 
1524
  `t` text
 
1525
) ENGINE=InnoDB
1533
1526
create  table t3 select * from t1;
1534
1527
show create table t3;
1535
1528
Table   Create Table
1536
1529
t3      CREATE TABLE `t3` (
1537
 
  `v` VARCHAR(10) COLLATE utf8_general_ci DEFAULT NULL,
1538
 
  `c` VARCHAR(10) COLLATE utf8_general_ci DEFAULT NULL,
1539
 
  `t` TEXT COLLATE utf8_general_ci
1540
 
) ENGINE=InnoDB COLLATE = utf8_general_ci
 
1530
  `v` varchar(10) DEFAULT NULL,
 
1531
  `c` varchar(10) DEFAULT NULL,
 
1532
  `t` text
 
1533
) ENGINE=InnoDB
1541
1534
alter table t1 modify c varchar(10);
1542
1535
show create table t1;
1543
1536
Table   Create Table
1544
1537
t1      CREATE TABLE `t1` (
1545
 
  `v` VARCHAR(10) COLLATE utf8_general_ci DEFAULT NULL,
1546
 
  `c` VARCHAR(10) COLLATE utf8_general_ci DEFAULT NULL,
1547
 
  `t` TEXT COLLATE utf8_general_ci
1548
 
) ENGINE=InnoDB COLLATE = utf8_general_ci
 
1538
  `v` varchar(10) DEFAULT NULL,
 
1539
  `c` varchar(10) DEFAULT NULL,
 
1540
  `t` text
 
1541
) ENGINE=InnoDB
1549
1542
alter table t1 modify v char(10);
1550
1543
show create table t1;
1551
1544
Table   Create Table
1552
1545
t1      CREATE TABLE `t1` (
1553
 
  `v` VARCHAR(10) COLLATE utf8_general_ci DEFAULT NULL,
1554
 
  `c` VARCHAR(10) COLLATE utf8_general_ci DEFAULT NULL,
1555
 
  `t` TEXT COLLATE utf8_general_ci
1556
 
) ENGINE=InnoDB COLLATE = utf8_general_ci
 
1546
  `v` varchar(10) DEFAULT NULL,
 
1547
  `c` varchar(10) DEFAULT NULL,
 
1548
  `t` text
 
1549
) ENGINE=InnoDB
1557
1550
alter table t1 modify t varchar(10);
 
1551
Warnings:
 
1552
Note    1265    Data truncated for column 't' at row 2
1558
1553
show create table t1;
1559
1554
Table   Create Table
1560
1555
t1      CREATE TABLE `t1` (
1561
 
  `v` VARCHAR(10) COLLATE utf8_general_ci DEFAULT NULL,
1562
 
  `c` VARCHAR(10) COLLATE utf8_general_ci DEFAULT NULL,
1563
 
  `t` VARCHAR(10) COLLATE utf8_general_ci DEFAULT NULL
1564
 
) ENGINE=InnoDB COLLATE = utf8_general_ci
 
1556
  `v` varchar(10) DEFAULT NULL,
 
1557
  `c` varchar(10) DEFAULT NULL,
 
1558
  `t` varchar(10) DEFAULT NULL
 
1559
) ENGINE=InnoDB
1565
1560
select concat('*',v,'*',c,'*',t,'*') from t1;
1566
1561
concat('*',v,'*',c,'*',t,'*')
1567
1562
*+ *+ *+ *
1571
1566
show create table t1;
1572
1567
Table   Create Table
1573
1568
t1      CREATE TABLE `t1` (
1574
 
  `v` VARCHAR(10) COLLATE utf8_general_ci DEFAULT NULL,
1575
 
  `c` VARCHAR(10) COLLATE utf8_general_ci DEFAULT NULL,
1576
 
  `t` TEXT COLLATE utf8_general_ci,
 
1569
  `v` varchar(10) DEFAULT NULL,
 
1570
  `c` varchar(10) DEFAULT NULL,
 
1571
  `t` text,
1577
1572
  KEY `v` (`v`),
1578
1573
  KEY `c` (`c`),
1579
1574
  KEY `t` (`t`(10))
1580
 
) ENGINE=InnoDB COLLATE = utf8_general_ci
 
1575
) ENGINE=InnoDB
1581
1576
select count(*) from t1;
1582
1577
count(*)
1583
1578
270
1788
1783
i       10
1789
1784
alter table t1 modify v varchar(300), drop key v, drop key v_2, add key v (v);
1790
1785
Warnings:
1791
 
Warning 1071    Specified key was too long; max key length is 1023 bytes
 
1786
Warning 1071    Specified key was too long; max key length is 767 bytes
1792
1787
show create table t1;
1793
1788
Table   Create Table
1794
1789
t1      CREATE TABLE `t1` (
1795
 
  `v` VARCHAR(300) COLLATE utf8_general_ci DEFAULT NULL,
1796
 
  `c` VARCHAR(10) COLLATE utf8_general_ci DEFAULT NULL,
1797
 
  `t` TEXT COLLATE utf8_general_ci,
 
1790
  `v` varchar(300) DEFAULT NULL,
 
1791
  `c` varchar(10) DEFAULT NULL,
 
1792
  `t` text,
1798
1793
  KEY `c` (`c`),
1799
1794
  KEY `t` (`t`(10)),
1800
 
  KEY `v` (`v`(255))
1801
 
) ENGINE=InnoDB COLLATE = utf8_general_ci
 
1795
  KEY `v` (`v`(191))
 
1796
) ENGINE=InnoDB
1802
1797
select count(*) from t1 where v='a';
1803
1798
count(*)
1804
1799
10
1819
1814
9
1820
1815
explain select count(*) from t1 where v='a  ';
1821
1816
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
1822
 
1       SIMPLE  t1      ref     v       v       1023    const   #       Using where
 
1817
1       SIMPLE  t1      ref     v       v       767     const   #       Using where
1823
1818
explain select count(*) from t1 where v like 'a%';
1824
1819
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
1825
 
1       SIMPLE  t1      range   v       v       1023    NULL    #       Using where
 
1820
1       SIMPLE  t1      range   v       v       767     NULL    #       Using where
1826
1821
explain select count(*) from t1 where v between 'a' and 'a ';
1827
1822
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
1828
 
1       SIMPLE  t1      ref     v       v       1023    const   #       Using where
 
1823
1       SIMPLE  t1      ref     v       v       767     const   #       Using where
1829
1824
explain select count(*) from t1 where v between 'a' and 'a ' and v between 'a  ' and 'b\n';
1830
1825
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
1831
 
1       SIMPLE  t1      ref     v       v       1023    const   #       Using where
 
1826
1       SIMPLE  t1      ref     v       v       767     const   #       Using where
1832
1827
explain select * from t1 where v='a';
1833
1828
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
1834
 
1       SIMPLE  t1      ref     v       v       1023    const   #       Using where
 
1829
1       SIMPLE  t1      ref     v       v       767     const   #       Using where
1835
1830
select v,count(*) from t1 group by v limit 10;
1836
1831
v       count(*)
1837
1832
a      1
1872
1867
show create table t1;
1873
1868
Table   Create Table
1874
1869
t1      CREATE TABLE `t1` (
1875
 
  `v` VARCHAR(300) COLLATE utf8_general_ci DEFAULT NULL,
1876
 
  `c` VARCHAR(10) COLLATE utf8_general_ci DEFAULT NULL,
1877
 
  `t` TEXT COLLATE utf8_general_ci,
 
1870
  `v` varchar(300) DEFAULT NULL,
 
1871
  `c` varchar(10) DEFAULT NULL,
 
1872
  `t` text,
1878
1873
  KEY `c` (`c`),
1879
1874
  KEY `t` (`t`(10)),
1880
1875
  KEY `v` (`v`(30))
1881
 
) ENGINE=InnoDB COLLATE = utf8_general_ci
 
1876
) ENGINE=InnoDB
1882
1877
select count(*) from t1 where v='a';
1883
1878
count(*)
1884
1879
10
1950
1945
i       10
1951
1946
alter table t1 modify v varchar(600), drop key v, add key v (v);
1952
1947
Warnings:
1953
 
Warning 1071    Specified key was too long; max key length is 1023 bytes
 
1948
Warning 1071    Specified key was too long; max key length is 767 bytes
1954
1949
show create table t1;
1955
1950
Table   Create Table
1956
1951
t1      CREATE TABLE `t1` (
1957
 
  `v` VARCHAR(600) COLLATE utf8_general_ci DEFAULT NULL,
1958
 
  `c` VARCHAR(10) COLLATE utf8_general_ci DEFAULT NULL,
1959
 
  `t` TEXT COLLATE utf8_general_ci,
 
1952
  `v` varchar(600) DEFAULT NULL,
 
1953
  `c` varchar(10) DEFAULT NULL,
 
1954
  `t` text,
1960
1955
  KEY `c` (`c`),
1961
1956
  KEY `t` (`t`(10)),
1962
 
  KEY `v` (`v`(255))
1963
 
) ENGINE=InnoDB COLLATE = utf8_general_ci
 
1957
  KEY `v` (`v`(191))
 
1958
) ENGINE=InnoDB
1964
1959
select v,count(*) from t1 group by v limit 10;
1965
1960
v       count(*)
1966
1961
a      1
2008
2003
insert into t1 values ('a     ');
2009
2004
ERROR 23000: Duplicate entry 'a     ' for key 'a'
2010
2005
insert into t1 values ('a          ');
2011
 
ERROR 22001: Data too long for column 'a' at row 1
 
2006
ERROR 23000: Duplicate entry 'a         ' for key 'a'
2012
2007
insert into t1 values ('a ');
2013
2008
ERROR 23000: Duplicate entry 'a ' for key 'a'
2014
2009
update t1 set a='a  ' where a like 'a%';
2032
2027
show create table t1;
2033
2028
Table   Create Table
2034
2029
t1      CREATE TABLE `t1` (
2035
 
  `v` VARCHAR(10) COLLATE utf8_general_ci DEFAULT NULL,
2036
 
  `c` VARCHAR(10) COLLATE utf8_general_ci DEFAULT NULL,
2037
 
  `t` TEXT COLLATE utf8_general_ci,
 
2030
  `v` varchar(10) DEFAULT NULL,
 
2031
  `c` varchar(10) DEFAULT NULL,
 
2032
  `t` text,
2038
2033
  KEY `v` (`v`(5)),
2039
2034
  KEY `c` (`c`(5)),
2040
2035
  KEY `t` (`t`(5))
2041
 
) ENGINE=InnoDB COLLATE = utf8_general_ci
 
2036
) ENGINE=InnoDB
2042
2037
drop table t1;
2043
2038
create  table t1 (v char(10));
2044
2039
show create table t1;
2045
2040
Table   Create Table
2046
2041
t1      CREATE TABLE `t1` (
2047
 
  `v` VARCHAR(10) COLLATE utf8_general_ci DEFAULT NULL
2048
 
) ENGINE=InnoDB COLLATE = utf8_general_ci
 
2042
  `v` varchar(10) DEFAULT NULL
 
2043
) ENGINE=InnoDB
2049
2044
drop table t1;
2050
2045
create  table t1 (v varchar(10), c char(10));
2051
2046
show create table t1;
2052
2047
Table   Create Table
2053
2048
t1      CREATE TABLE `t1` (
2054
 
  `v` VARCHAR(10) COLLATE utf8_general_ci DEFAULT NULL,
2055
 
  `c` VARCHAR(10) COLLATE utf8_general_ci DEFAULT NULL
2056
 
) ENGINE=InnoDB COLLATE = utf8_general_ci
 
2049
  `v` varchar(10) DEFAULT NULL,
 
2050
  `c` varchar(10) DEFAULT NULL
 
2051
) ENGINE=InnoDB
2057
2052
insert into t1 values('a','a'),('a ','a ');
2058
2053
select concat('*',v,'*',c,'*') from t1;
2059
2054
concat('*',v,'*',c,'*')
2071
2066
drop table t1;
2072
2067
create table t1 (v varchar(16383), key(v));
2073
2068
Warnings:
2074
 
Warning 1071    Specified key was too long; max key length is 1023 bytes
2075
 
drop table t1;
2076
 
create table t1 (v varchar(16383));
2077
 
show create table t1;
2078
 
Table   Create Table
2079
 
t1      CREATE TABLE `t1` (
2080
 
  `v` VARCHAR(16383) COLLATE utf8_general_ci DEFAULT NULL
2081
 
) ENGINE=InnoDB COLLATE = utf8_general_ci
2082
 
drop table t1;
2083
 
create table t1 (v varchar(16383));
2084
 
show create table t1;
2085
 
Table   Create Table
2086
 
t1      CREATE TABLE `t1` (
2087
 
  `v` VARCHAR(16383) COLLATE utf8_general_ci DEFAULT NULL
2088
 
) ENGINE=InnoDB COLLATE = utf8_general_ci
 
2069
Warning 1071    Specified key was too long; max key length is 767 bytes
 
2070
drop table t1;
 
2071
create table t1 (v varchar(16383));
 
2072
show create table t1;
 
2073
Table   Create Table
 
2074
t1      CREATE TABLE `t1` (
 
2075
  `v` varchar(16383) DEFAULT NULL
 
2076
) ENGINE=InnoDB
 
2077
drop table t1;
 
2078
create table t1 (v varchar(16383));
 
2079
show create table t1;
 
2080
Table   Create Table
 
2081
t1      CREATE TABLE `t1` (
 
2082
  `v` varchar(16383) DEFAULT NULL
 
2083
) ENGINE=InnoDB
2089
2084
drop table t1;
2090
2085
set storage_engine=InnoDB;
2091
2086
create table t1 (v varchar(16383)) engine=innodb;
2129
2124
3       1
2130
2125
4       2
2131
2126
drop table t1;
 
2127
create table t1 (a int not null auto_increment primary key, val int) engine=InnoDB;
 
2128
insert into t1 (val) values (1);
 
2129
update t1 set a=2 where a=1;
 
2130
insert into t1 (val) values (1);
 
2131
ERROR 23000: Duplicate entry '2' for key 'PRIMARY'
 
2132
select * from t1;
 
2133
a       val
 
2134
2       1
 
2135
drop table t1;
2132
2136
CREATE TABLE t1 (GRADE DECIMAL(4) NOT NULL, PRIMARY KEY (GRADE)) ENGINE=INNODB;
2133
2137
INSERT INTO t1 (GRADE) VALUES (151),(252),(343);
2134
2138
SELECT GRADE  FROM t1 WHERE GRADE > 160 AND GRADE < 300;
2176
2180
create table t1 (col1 varchar(2000), index (col1(767)))
2177
2181
engine = innodb;
2178
2182
Warnings:
2179
 
Warning 1071    Specified key was too long; max key length is 1023 bytes
 
2183
Warning 1071    Specified key was too long; max key length is 767 bytes
2180
2184
create table t2 (col1 char(255), index (col1))
2181
2185
engine = innodb;
 
2186
Warnings:
 
2187
Warning 1071    Specified key was too long; max key length is 767 bytes
2182
2188
create table t4 (col1 varchar(767), index (col1))
2183
2189
engine = innodb;
2184
2190
Warnings:
2185
 
Warning 1071    Specified key was too long; max key length is 1023 bytes
 
2191
Warning 1071    Specified key was too long; max key length is 767 bytes
2186
2192
create table t5 (col1 varchar(190) primary key)
2187
2193
engine = innodb;
2188
2194
create table t6 (col1 varbinary(254) primary key)
2190
2196
create table t7 (col1 text, index(col1(767)))
2191
2197
engine = innodb;
2192
2198
Warnings:
2193
 
Warning 1071    Specified key was too long; max key length is 1023 bytes
 
2199
Warning 1071    Specified key was too long; max key length is 767 bytes
2194
2200
create table t8 (col1 blob, index(col1(767)))
2195
2201
engine = innodb;
2196
2202
create table t9 (col1 varchar(512), col2 varchar(512), index(col1, col2))
2197
2203
engine = innodb;
2198
2204
Warnings:
2199
 
Warning 1071    Specified key was too long; max key length is 1023 bytes
2200
 
Warning 1071    Specified key was too long; max key length is 1023 bytes
 
2205
Warning 1071    Specified key was too long; max key length is 767 bytes
 
2206
Warning 1071    Specified key was too long; max key length is 767 bytes
2201
2207
show create table t9;
2202
2208
Table   Create Table
2203
2209
t9      CREATE TABLE `t9` (
2204
 
  `col1` VARCHAR(512) COLLATE utf8_general_ci DEFAULT NULL,
2205
 
  `col2` VARCHAR(512) COLLATE utf8_general_ci DEFAULT NULL,
2206
 
  KEY `col1` (`col1`(255),`col2`(255))
2207
 
) ENGINE=InnoDB COLLATE = utf8_general_ci
 
2210
  `col1` varchar(512) DEFAULT NULL,
 
2211
  `col2` varchar(512) DEFAULT NULL,
 
2212
  KEY `col1` (`col1`(191),`col2`(191))
 
2213
) ENGINE=InnoDB
2208
2214
drop table t1, t2, t4, t5, t6, t7, t8, t9;
2209
2215
create table t1 (col1 varchar(768), index(col1))
2210
2216
engine = innodb;
2211
2217
Warnings:
2212
 
Warning 1071    Specified key was too long; max key length is 1023 bytes
 
2218
Warning 1071    Specified key was too long; max key length is 767 bytes
2213
2219
create table t2 (col1 varbinary(768), index(col1))
2214
2220
engine = innodb;
 
2221
Warnings:
 
2222
Warning 1071    Specified key was too long; max key length is 767 bytes
2215
2223
create table t3 (col1 text, index(col1(768)))
2216
2224
engine = innodb;
2217
2225
Warnings:
2218
 
Warning 1071    Specified key was too long; max key length is 1023 bytes
 
2226
Warning 1071    Specified key was too long; max key length is 767 bytes
2219
2227
create table t4 (col1 blob, index(col1(768)))
2220
2228
engine = innodb;
 
2229
Warnings:
 
2230
Warning 1071    Specified key was too long; max key length is 767 bytes
2221
2231
show create table t1;
2222
2232
Table   Create Table
2223
2233
t1      CREATE TABLE `t1` (
2224
 
  `col1` VARCHAR(768) COLLATE utf8_general_ci DEFAULT NULL,
2225
 
  KEY `col1` (`col1`(255))
2226
 
) ENGINE=InnoDB COLLATE = utf8_general_ci
 
2234
  `col1` varchar(768) DEFAULT NULL,
 
2235
  KEY `col1` (`col1`(191))
 
2236
) ENGINE=InnoDB
2227
2237
drop table t1, t2, t3, t4;
2228
2238
create table t1 (col1 varchar(768) primary key)
2229
2239
engine = innodb;
2230
 
ERROR 42000: Specified key was too long; max key length is 1023 bytes
2231
 
create table t2 (col1 varbinary(1024) primary key)
 
2240
ERROR 42000: Specified key was too long; max key length is 767 bytes
 
2241
create table t2 (col1 varbinary(768) primary key)
2232
2242
engine = innodb;
2233
 
ERROR 42000: Specified key was too long; max key length is 1023 bytes
 
2243
ERROR 42000: Specified key was too long; max key length is 767 bytes
2234
2244
create table t3 (col1 text, primary key(col1(768)))
2235
2245
engine = innodb;
2236
 
ERROR 42000: Specified key was too long; max key length is 1023 bytes
2237
 
create table t4 (col1 blob, primary key(col1(1024)))
 
2246
ERROR 42000: Specified key was too long; max key length is 767 bytes
 
2247
create table t4 (col1 blob, primary key(col1(768)))
2238
2248
engine = innodb;
2239
 
ERROR 42000: Specified key was too long; max key length is 1023 bytes
 
2249
ERROR 42000: Specified key was too long; max key length is 767 bytes
2240
2250
CREATE TABLE t1
2241
2251
(
2242
2252
id INT PRIMARY KEY
2260
2270
INSERT INTO t2 VALUES(3);
2261
2271
ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `c1` FOREIGN KEY (`v`) REFERENCES `t1` (`id`))
2262
2272
DROP TABLE t2;
 
2273
create table t1(a int not null) engine=innodb;
 
2274
insert into t1 values (1),(2);
 
2275
set autocommit=0;
 
2276
checksum table t1;
 
2277
Table   Checksum
 
2278
test.t1 1531596814
 
2279
insert into t1 values(3);
 
2280
checksum table t1;
 
2281
Table   Checksum
 
2282
test.t1 1531596814
 
2283
commit;
 
2284
checksum table t1;
 
2285
Table   Checksum
 
2286
test.t1 2050879373
 
2287
commit;
 
2288
drop table t1;
 
2289
create table t1(a int not null) engine=innodb;
 
2290
insert into t1 values (1),(2);
 
2291
set autocommit=1;
 
2292
checksum table t1;
 
2293
Table   Checksum
 
2294
test.t1 1531596814
 
2295
set autocommit=1;
 
2296
insert into t1 values(3);
 
2297
checksum table t1;
 
2298
Table   Checksum
 
2299
test.t1 2050879373
 
2300
drop table t1;
2263
2301
set foreign_key_checks=0;
2264
2302
create table t2 (a int primary key, b int, foreign key (b) references t1(a)) engine = innodb;
2265
2303
create table t1(a char(10) primary key, b varchar(20)) engine = innodb;
2306
2344
b varchar(255),
2307
2345
c varchar(255),
2308
2346
d varchar(255),
2309
 
key (a(200),b(200),c(200),d(200))) engine=innodb;
 
2347
key (a,b,c,d)) engine=innodb;
 
2348
Warnings:
 
2349
Warning 1071    Specified key was too long; max key length is 767 bytes
 
2350
Warning 1071    Specified key was too long; max key length is 767 bytes
 
2351
Warning 1071    Specified key was too long; max key length is 767 bytes
 
2352
Warning 1071    Specified key was too long; max key length is 767 bytes
2310
2353
drop table t1;
2311
2354
create table t1 (a varchar(255),
2312
2355
b varchar(255),
2420
2463
SHOW CREATE TABLE t2;
2421
2464
Table   Create Table
2422
2465
t2      CREATE TABLE `t2` (
2423
 
  `a` INT DEFAULT NULL,
 
2466
  `a` int DEFAULT NULL,
2424
2467
  KEY `t2_ibfk_0` (`a`)
2425
 
) ENGINE=InnoDB COLLATE = utf8_general_ci
 
2468
) ENGINE=InnoDB
2426
2469
DROP TABLE t2,t1;
2427
2470
CREATE TABLE t1 (
2428
2471
field1 varchar(8) NOT NULL DEFAULT '',
2457
2500
show create table t1;
2458
2501
Table   Create Table
2459
2502
t1      CREATE TABLE `t1` (
2460
 
  `c1` BIGINT NOT NULL,
2461
 
  `c2` BIGINT NOT NULL,
 
2503
  `c1` bigint NOT NULL,
 
2504
  `c2` bigint NOT NULL,
2462
2505
  PRIMARY KEY (`c1`),
2463
2506
  UNIQUE KEY `c2` (`c2`),
2464
2507
  CONSTRAINT `c2_fk` FOREIGN KEY (`c2`) REFERENCES `t2` (`c1`) ON DELETE CASCADE
2465
 
) ENGINE=InnoDB COLLATE = utf8_general_ci
 
2508
) ENGINE=InnoDB
2466
2509
alter table t1 drop foreign key c2_fk;
2467
2510
show create table t1;
2468
2511
Table   Create Table
2469
2512
t1      CREATE TABLE `t1` (
2470
 
  `c1` BIGINT NOT NULL,
2471
 
  `c2` BIGINT NOT NULL,
 
2513
  `c1` bigint NOT NULL,
 
2514
  `c2` bigint NOT NULL,
2472
2515
  PRIMARY KEY (`c1`),
2473
2516
  UNIQUE KEY `c2` (`c2`)
2474
 
) ENGINE=InnoDB COLLATE = utf8_general_ci
 
2517
) ENGINE=InnoDB
2475
2518
drop table t1, t2;
2476
2519
create table t1(a date) engine=innodb;
2477
2520
create table t2(a date, key(a)) engine=innodb;
2543
2586
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
2544
2587
insert into t1 select * from t2;
2545
2588
update t1 set b = (select e from t2 where a = d);
2546
 
commit;
2547
2589
create table t3(d int not null, e int, primary key(d)) engine=innodb
2548
2590
select * from t2;
2549
2591
commit;
2609
2651
commit;
2610
2652
drop table t1, t2, t3, t5, t6, t8, t9;
2611
2653
CREATE TABLE t1 (DB_ROW_ID int) engine=innodb;
2612
 
Got one of the listed errors
 
2654
ERROR HY000: Can't create table 'test.t1' (errno: -1)
2613
2655
CREATE TABLE t1 (
2614
2656
a BIGINT NOT NULL,
2615
2657
PRIMARY KEY  (a)
2623
2665
CONSTRAINT t_fk FOREIGN KEY (a) REFERENCES t1 (a) 
2624
2666
ON DELETE CASCADE
2625
2667
) ENGINE=INNODB;
 
2668
Warnings:
 
2669
Warning 1071    Specified key was too long; max key length is 767 bytes
2626
2670
INSERT INTO t1 VALUES (1);
2627
2671
INSERT INTO t2 VALUES (1, 'bar', 'vbar');
2628
2672
INSERT INTO t2 VALUES (1, 'BAR2', 'VBAR');
2648
2692
CREATE TABLE t1 ( a int ) ENGINE=innodb;
2649
2693
BEGIN;
2650
2694
INSERT INTO t1 VALUES (1);
2651
 
COMMIT;
2652
2695
ALTER TABLE t1 ENGINE=innodb;
2653
2696
DROP TABLE t1;
2654
2697
CREATE TABLE t1 (id int PRIMARY KEY, f int NOT NULL, INDEX(f)) ENGINE=InnoDB;
2660
2703
SHOW CREATE TABLE t2;
2661
2704
Table   Create Table
2662
2705
t2      CREATE TABLE `t2` (
2663
 
  `id` INT NOT NULL,
2664
 
  `f` INT NOT NULL,
 
2706
  `id` int NOT NULL,
 
2707
  `f` int NOT NULL,
2665
2708
  PRIMARY KEY (`id`),
2666
2709
  KEY `f` (`f`),
2667
 
  CONSTRAINT `t2_t1` FOREIGN KEY (`id`) REFERENCES `t1` (`id`) ON UPDATE CASCADE ON DELETE CASCADE,
2668
 
  CONSTRAINT `t2_ibfk_2` FOREIGN KEY (`f`) REFERENCES `t1` (`f`) ON UPDATE CASCADE ON DELETE CASCADE
2669
 
) ENGINE=InnoDB COLLATE = utf8_general_ci
 
2710
  CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`f`) REFERENCES `t1` (`f`) ON DELETE CASCADE ON UPDATE CASCADE,
 
2711
  CONSTRAINT `t2_t1` FOREIGN KEY (`id`) REFERENCES `t1` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
 
2712
) ENGINE=InnoDB
2670
2713
DROP TABLE t2, t1;
2671
2714
CREATE TABLE t1 (a INT, INDEX(a)) ENGINE=InnoDB;
2672
2715
CREATE TABLE t2 (a INT, INDEX(a)) ENGINE=InnoDB;
2674
2717
INSERT INTO t2 VALUES (1);
2675
2718
ALTER TABLE t2 ADD FOREIGN KEY (a) REFERENCES t1 (a) ON DELETE SET NULL;
2676
2719
ALTER TABLE t2 MODIFY a INT NOT NULL;
2677
 
ERROR HY000: Error on rename of '#sql-temporary' to 'test.t2' (errno: 150)
 
2720
ERROR HY000: Error on rename of '#sql-temporary' to './test/t2' (errno: 150)
2678
2721
DELETE FROM t1;
2679
2722
DROP TABLE t2,t1;
2680
2723
CREATE TABLE t1 (a VARCHAR(5) COLLATE utf8_unicode_ci PRIMARY KEY)
2697
2740
SHOW CREATE TABLE t1;
2698
2741
Table   Create Table
2699
2742
t1      CREATE TABLE `t1` (
2700
 
  `id` INT NOT NULL AUTO_INCREMENT,
 
2743
  `id` int NOT NULL AUTO_INCREMENT,
2701
2744
  PRIMARY KEY (`id`)
2702
 
) ENGINE=InnoDB COLLATE = utf8_general_ci AUTO_INCREMENT=42
 
2745
) ENGINE=InnoDB
2703
2746
CREATE TABLE t2 (id int PRIMARY KEY) ENGINE=InnoDB;
2704
2747
INSERT INTO t2 VALUES(42),(347),(348);
2705
2748
ALTER TABLE t1 ADD CONSTRAINT t1_t2 FOREIGN KEY (id) REFERENCES t2(id);
2706
2749
SHOW CREATE TABLE t1;
2707
2750
Table   Create Table
2708
2751
t1      CREATE TABLE `t1` (
2709
 
  `id` INT NOT NULL AUTO_INCREMENT,
 
2752
  `id` int NOT NULL AUTO_INCREMENT,
2710
2753
  PRIMARY KEY (`id`),
2711
2754
  CONSTRAINT `t1_t2` FOREIGN KEY (`id`) REFERENCES `t2` (`id`)
2712
 
) ENGINE=InnoDB COLLATE = utf8_general_ci
 
2755
) ENGINE=InnoDB
2713
2756
DROP TABLE t1,t2;
2714
2757
DROP TABLE IF EXISTS t1;
2715
2758
Warnings:
2727
2770
-10
2728
2771
1
2729
2772
DROP TABLE t1;
2730
 
SET GLOBAL innodb_lock_wait_timeout=@orig_lock_wait_timeout ;