~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to tests/r/innodb.result

  • Committer: Patrick Galbraith
  • Date: 2009-10-08 22:42:05 UTC
  • mto: (1166.5.3 memcached_functions)
  • mto: This revision was merged to the branch mainline in revision 1189.
  • Revision ID: patg@patrick-galbraiths-macbook-pro.local-20091008224205-gq1pehjsivvx0qo9
Starting over with a fresh tree, moved in memcached functions.

Memcached Functions for Drizzle. 

All tests pass.

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;
166
164
1       1005    101
167
165
1       1006    101
168
166
1       1007    101
169
 
alter table t1 ENGINE=innodb;
 
167
optimize table t1;
 
168
Table   Op      Msg_type        Msg_text
 
169
test.t1 optimize        status  OK
170
170
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
 
171
Table   Non_unique      Key_name        Seq_in_index    Column_name     Collation       Cardinality     Sub_part        Packed  Null    Index_type      Comment Index_Comment
 
172
t1      0       PRIMARY 1       id      A       #       NULL    NULL            BTREE           
 
173
t1      1       parent_id       1       parent_id       A       #       NULL    NULL            BTREE           
 
174
t1      1       level   1       level   A       #       NULL    NULL            BTREE           
175
175
drop table t1;
176
176
CREATE TABLE t1 (
177
177
gesuchnr int DEFAULT '0' NOT NULL,
188
188
drop table t1;
189
189
create table t1 (a int) engine=innodb;
190
190
insert into t1 values (1), (2);
191
 
alter table t1 engine=innodb;
 
191
optimize table t1;
 
192
Table   Op      Msg_type        Msg_text
 
193
test.t1 optimize        status  OK
192
194
delete from t1 where a = 1;
193
195
select * from t1;
194
196
a
209
211
Table   Op      Msg_type        Msg_text
210
212
test.t1 analyze status  OK
211
213
show keys from t1;
212
 
Table   Unique  Key_name        Seq_in_index    Column_name
213
 
t1      NO      skr     1       a
 
214
Table   Non_unique      Key_name        Seq_in_index    Column_name     Collation       Cardinality     Sub_part        Packed  Null    Index_type      Comment Index_Comment
 
215
t1      1       skr     1       a       A       #       NULL    NULL    YES     BTREE           
214
216
drop table t1;
215
217
create table t1 (a int,b varchar(20),key(a)) engine=innodb;
216
218
insert into t1 values (1,""), (2,"testing");
275
277
rollback to savepoint `my_savepoint`;
276
278
ERROR 42000: SAVEPOINT my_savepoint does not exist
277
279
rollback to savepoint savept2;
 
280
ERROR 42000: SAVEPOINT savept2 does not exist
278
281
insert into t1 values (8);
279
282
savepoint sv;
280
283
commit;
396
399
CREATE TABLE t1 (a int not null, b int not null,c int not null,
397
400
key(a),primary key(a,b), unique(c),key(a),unique(b));
398
401
show index from t1;
399
 
Table   Unique  Key_name        Seq_in_index    Column_name
400
 
t1      YES     PRIMARY 1       a
401
 
t1      YES     PRIMARY 2       b
402
 
t1      YES     c       1       c
403
 
t1      YES     b       1       b
404
 
t1      NO      a       1       a
405
 
t1      NO      a_2     1       a
 
402
Table   Non_unique      Key_name        Seq_in_index    Column_name     Collation       Cardinality     Sub_part        Packed  Null    Index_type      Comment Index_Comment
 
403
t1      0       PRIMARY 1       a       A       #       NULL    NULL            BTREE           
 
404
t1      0       PRIMARY 2       b       A       #       NULL    NULL            BTREE           
 
405
t1      0       c       1       c       A       #       NULL    NULL            BTREE           
 
406
t1      0       b       1       b       A       #       NULL    NULL            BTREE           
 
407
t1      1       a       1       a       A       #       NULL    NULL            BTREE           
 
408
t1      1       a_2     1       a       A       #       NULL    NULL            BTREE           
406
409
drop table t1;
407
410
create table t1 (col1 int not null, col2 char(4) not null, primary key(col1));
408
411
alter table t1 engine=innodb;
422
425
3       4
423
426
4       7
424
427
5       2
425
 
ALTER TABLE t1 ADD co3 INT DEFAULT 42 NOT NULL;
 
428
alter table t1 add co3 int not null;
426
429
select * from t1;
427
430
col1    col2    co3
428
 
1       1       42
429
 
2       3       42
430
 
3       4       42
431
 
4       7       42
432
 
5       2       42
 
431
1       1       0
 
432
2       3       0
 
433
3       4       0
 
434
4       7       0
 
435
5       2       0
433
436
update t1 set col2='9' where col1='2';
434
437
select * from t1;
435
438
col1    col2    co3
436
 
1       1       42
437
 
2       9       42
438
 
3       4       42
439
 
4       7       42
440
 
5       2       42
 
439
1       1       0
 
440
2       9       0
 
441
3       4       0
 
442
4       7       0
 
443
5       2       0
441
444
drop table t1;
442
445
create table t1 (a int not null , b int, primary key (a)) engine = innodb;
443
446
create TEMPORARY table t2 (a int not null , b int, primary key (a)) engine = myisam;
732
735
a       b
733
736
world   2
734
737
hello   1
735
 
alter table t1 engine=innodb;
 
738
optimize table t1;
 
739
Table   Op      Msg_type        Msg_text
 
740
test.t1 optimize        status  OK
736
741
show keys from t1;
737
 
Table   Unique  Key_name        Seq_in_index    Column_name
738
 
t1      YES     PRIMARY 1       a
 
742
Table   Non_unique      Key_name        Seq_in_index    Column_name     Collation       Cardinality     Sub_part        Packed  Null    Index_type      Comment Index_Comment
 
743
t1      0       PRIMARY 1       a       A       #       NULL    NULL            BTREE           
739
744
drop table t1;
740
745
create table t1 (i int, j int ) ENGINE=innodb;
741
746
insert into t1 values (1,2);
775
780
show create table t1;
776
781
Table   Create Table
777
782
t1      CREATE TABLE `t1` (
778
 
  `a` VARCHAR(20) COLLATE utf8_general_ci DEFAULT NULL,
 
783
  `a` varchar(20) DEFAULT NULL,
779
784
  KEY `a` (`a`(5))
780
 
) ENGINE=InnoDB COLLATE = utf8_general_ci
 
785
) ENGINE=InnoDB
781
786
drop table t1;
782
787
create temporary table t1 (a int not null auto_increment, primary key(a)) engine=innodb;
783
788
insert into t1 values (NULL),(NULL),(NULL);
820
825
insert into mysqltest.t1 values(1);
821
826
create TEMPORARY table mysqltest.t2 (a int not null) engine= myisam;
822
827
insert into mysqltest.t2 values(1);
823
 
create temporary table mysqltest.t3 (a int not null) engine= MEMORY;
 
828
create temporary table mysqltest.t3 (a int not null) engine= heap;
824
829
insert into mysqltest.t3 values(1);
825
830
commit;
826
831
drop database mysqltest;
827
832
show tables from mysqltest;
828
 
ERROR 42000: Unknown schema 'mysqltest'
 
833
ERROR 42000: Unknown database 'mysqltest'
829
834
set autocommit=0;
830
835
create table t1 (a int not null) engine= innodb;
831
836
insert into t1 values(1),(2);
885
890
drop table t1;
886
891
create table t1 (t int not null default 1, key (t)) engine=innodb;
887
892
desc t1;
888
 
Field   Type    Null    Default Default_is_NULL On_Update
889
 
t       INTEGER NO      1       NO      
 
893
Field   Type    Null    Key     Default Extra
 
894
t       int     NO      MUL     1       
890
895
drop table t1;
891
896
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;
892
897
BEGIN;
1129
1134
insert t1 values (1, "aaa", "bbb"), (NULL, "", "ccccc"), (0, NULL, "");
1130
1135
insert t2 select * from t1;
1131
1136
insert t3 select * from t1;
 
1137
checksum table t1, t2, t3, t4 quick;
 
1138
Table   Checksum
 
1139
test.t1 NULL
 
1140
test.t2 NULL
 
1141
test.t3 NULL
 
1142
test.t4 NULL
 
1143
Warnings:
 
1144
Error   1146    Table 'test.t4' doesn't exist
 
1145
checksum table t1, t2, t3, t4;
 
1146
Table   Checksum
 
1147
test.t1 2948697075
 
1148
test.t2 2948697075
 
1149
test.t3 2948697075
 
1150
test.t4 NULL
 
1151
Warnings:
 
1152
Error   1146    Table 'test.t4' doesn't exist
 
1153
checksum table t1, t2, t3, t4 extended;
 
1154
Table   Checksum
 
1155
test.t1 2948697075
 
1156
test.t2 2948697075
 
1157
test.t3 2948697075
 
1158
test.t4 NULL
 
1159
Warnings:
 
1160
Error   1146    Table 'test.t4' doesn't exist
1132
1161
drop table t1,t2,t3;
1133
1162
create table t1 (id int,  name char(10) not null,  name2 char(10) not null) engine=innodb;
1134
1163
insert into t1 values(1,'first','fff'),(2,'second','sss'),(3,'third','ttt');
1152
1181
show create table t1;
1153
1182
Table   Create Table
1154
1183
t1      CREATE TABLE `t1` (
1155
 
  `id` INT NOT NULL,
1156
 
  `id2` INT NOT NULL,
 
1184
  `id` int NOT NULL,
 
1185
  `id2` int NOT NULL,
1157
1186
  UNIQUE KEY `id` (`id`,`id2`)
1158
 
) ENGINE=InnoDB COLLATE = utf8_general_ci
 
1187
) ENGINE=InnoDB
1159
1188
show create table t2;
1160
1189
Table   Create Table
1161
1190
t2      CREATE TABLE `t2` (
1162
 
  `id` INT NOT NULL,
 
1191
  `id` int NOT NULL,
1163
1192
  KEY `t1_id_fk` (`id`),
1164
1193
  CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`) REFERENCES `t1` (`id`)
1165
 
) ENGINE=InnoDB COLLATE = utf8_general_ci
 
1194
) ENGINE=InnoDB
1166
1195
create index id on t2 (id);
1167
1196
show create table t2;
1168
1197
Table   Create Table
1169
1198
t2      CREATE TABLE `t2` (
1170
 
  `id` INT NOT NULL,
 
1199
  `id` int NOT NULL,
1171
1200
  KEY `id` (`id`),
1172
1201
  CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`) REFERENCES `t1` (`id`)
1173
 
) ENGINE=InnoDB COLLATE = utf8_general_ci
 
1202
) ENGINE=InnoDB
1174
1203
create index id2 on t2 (id);
1175
1204
show create table t2;
1176
1205
Table   Create Table
1177
1206
t2      CREATE TABLE `t2` (
1178
 
  `id` INT NOT NULL,
 
1207
  `id` int NOT NULL,
1179
1208
  KEY `id` (`id`),
1180
1209
  KEY `id2` (`id`),
1181
1210
  CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`) REFERENCES `t1` (`id`)
1182
 
) ENGINE=InnoDB COLLATE = utf8_general_ci
 
1211
) ENGINE=InnoDB
1183
1212
drop index id2 on t2;
1184
1213
drop index id on t2;
1185
1214
Got one of the listed errors
1186
1215
show create table t2;
1187
1216
Table   Create Table
1188
1217
t2      CREATE TABLE `t2` (
1189
 
  `id` INT NOT NULL,
 
1218
  `id` int NOT NULL,
1190
1219
  KEY `id` (`id`),
1191
1220
  CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`) REFERENCES `t1` (`id`)
1192
 
) ENGINE=InnoDB COLLATE = utf8_general_ci
 
1221
) ENGINE=InnoDB
1193
1222
drop table t2;
1194
1223
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;
1195
1224
show create table t2;
1196
1225
Table   Create Table
1197
1226
t2      CREATE TABLE `t2` (
1198
 
  `id` INT NOT NULL,
1199
 
  `id2` INT NOT NULL,
 
1227
  `id` int NOT NULL,
 
1228
  `id2` int NOT NULL,
1200
1229
  KEY `t1_id_fk` (`id`,`id2`),
1201
1230
  CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`, `id2`) REFERENCES `t1` (`id`, `id2`)
1202
 
) ENGINE=InnoDB COLLATE = utf8_general_ci
 
1231
) ENGINE=InnoDB
1203
1232
create unique index id on t2 (id,id2);
1204
1233
show create table t2;
1205
1234
Table   Create Table
1206
1235
t2      CREATE TABLE `t2` (
1207
 
  `id` INT NOT NULL,
1208
 
  `id2` INT NOT NULL,
 
1236
  `id` int NOT NULL,
 
1237
  `id2` int NOT NULL,
1209
1238
  UNIQUE KEY `id` (`id`,`id2`),
1210
1239
  CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`, `id2`) REFERENCES `t1` (`id`, `id2`)
1211
 
) ENGINE=InnoDB COLLATE = utf8_general_ci
 
1240
) ENGINE=InnoDB
1212
1241
drop table t2;
1213
1242
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;
1214
1243
show create table t2;
1215
1244
Table   Create Table
1216
1245
t2      CREATE TABLE `t2` (
1217
 
  `id` INT NOT NULL,
1218
 
  `id2` INT NOT NULL,
 
1246
  `id` int NOT NULL,
 
1247
  `id2` int NOT NULL,
1219
1248
  UNIQUE KEY `id` (`id`,`id2`),
1220
1249
  KEY `t1_id_fk` (`id2`,`id`),
1221
1250
  CONSTRAINT `t1_id_fk` FOREIGN KEY (`id2`, `id`) REFERENCES `t1` (`id`, `id2`)
1222
 
) ENGINE=InnoDB COLLATE = utf8_general_ci
 
1251
) ENGINE=InnoDB
1223
1252
drop table t2;
1224
1253
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;
1225
1254
show create table t2;
1226
1255
Table   Create Table
1227
1256
t2      CREATE TABLE `t2` (
1228
 
  `id` INT NOT NULL,
1229
 
  `id2` INT NOT NULL,
 
1257
  `id` int NOT NULL,
 
1258
  `id2` int NOT NULL,
1230
1259
  UNIQUE KEY `id` (`id`,`id2`),
1231
1260
  CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`) REFERENCES `t1` (`id`)
1232
 
) ENGINE=InnoDB COLLATE = utf8_general_ci
 
1261
) ENGINE=InnoDB
1233
1262
drop table t2;
1234
1263
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;
1235
1264
show create table t2;
1236
1265
Table   Create Table
1237
1266
t2      CREATE TABLE `t2` (
1238
 
  `id` INT NOT NULL,
1239
 
  `id2` INT NOT NULL,
 
1267
  `id` int NOT NULL,
 
1268
  `id2` int NOT NULL,
1240
1269
  UNIQUE KEY `id` (`id`,`id2`),
1241
1270
  KEY `t1_id_fk` (`id2`,`id`),
1242
1271
  CONSTRAINT `t1_id_fk` FOREIGN KEY (`id2`, `id`) REFERENCES `t1` (`id`, `id2`)
1243
 
) ENGINE=InnoDB COLLATE = utf8_general_ci
 
1272
) ENGINE=InnoDB
1244
1273
drop table t2;
1245
1274
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;
1246
1275
show create table t2;
1247
1276
Table   Create Table
1248
1277
t2      CREATE TABLE `t2` (
1249
 
  `id` INT NOT NULL AUTO_INCREMENT,
1250
 
  `id2` INT NOT NULL,
 
1278
  `id` int NOT NULL AUTO_INCREMENT,
 
1279
  `id2` int NOT NULL,
1251
1280
  PRIMARY KEY (`id`),
1252
1281
  KEY `id` (`id`,`id2`),
1253
1282
  CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`) REFERENCES `t1` (`id`)
1254
 
) ENGINE=InnoDB COLLATE = utf8_general_ci
 
1283
) ENGINE=InnoDB
1255
1284
drop table t2;
1256
1285
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;
1257
1286
show create table t2;
1258
1287
Table   Create Table
1259
1288
t2      CREATE TABLE `t2` (
1260
 
  `id` INT NOT NULL AUTO_INCREMENT,
1261
 
  `id2` INT NOT NULL,
 
1289
  `id` int NOT NULL AUTO_INCREMENT,
 
1290
  `id2` int NOT NULL,
1262
1291
  KEY `t1_id_fk` (`id`),
1263
1292
  CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`) REFERENCES `t1` (`id`)
1264
 
) ENGINE=InnoDB COLLATE = utf8_general_ci
 
1293
) ENGINE=InnoDB
1265
1294
alter table t2 add index id_test (id), add index id_test2 (id,id2);
1266
1295
show create table t2;
1267
1296
Table   Create Table
1268
1297
t2      CREATE TABLE `t2` (
1269
 
  `id` INT NOT NULL AUTO_INCREMENT,
1270
 
  `id2` INT NOT NULL,
 
1298
  `id` int NOT NULL AUTO_INCREMENT,
 
1299
  `id2` int NOT NULL,
1271
1300
  KEY `id_test` (`id`),
1272
1301
  KEY `id_test2` (`id`,`id2`),
1273
1302
  CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`) REFERENCES `t1` (`id`)
1274
 
) ENGINE=InnoDB COLLATE = utf8_general_ci
 
1303
) ENGINE=InnoDB
1275
1304
drop table t2;
1276
1305
create table t2 (id int not null, id2 int not null, constraint t1_id_fk foreign key (id2,id) references t1 (id)) engine = innodb;
1277
1306
ERROR 42000: Incorrect foreign key definition for 't1_id_fk': Key reference and table reference don't match
1279
1308
show create table t2;
1280
1309
Table   Create Table
1281
1310
t2      CREATE TABLE `t2` (
1282
 
  `a` INT NOT NULL AUTO_INCREMENT,
1283
 
  `b` INT DEFAULT NULL,
 
1311
  `a` int NOT NULL AUTO_INCREMENT,
 
1312
  `b` int DEFAULT NULL,
1284
1313
  PRIMARY KEY (`a`),
1285
1314
  UNIQUE KEY `b_2` (`b`),
1286
1315
  KEY `b` (`b`),
1287
1316
  CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`b`) REFERENCES `t1` (`id`)
1288
 
) ENGINE=InnoDB COLLATE = utf8_general_ci
 
1317
) ENGINE=InnoDB
1289
1318
drop table t2;
1290
1319
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;
1291
1320
show create table t2;
1292
1321
Table   Create Table
1293
1322
t2      CREATE TABLE `t2` (
1294
 
  `a` INT NOT NULL AUTO_INCREMENT,
1295
 
  `b` INT DEFAULT NULL,
 
1323
  `a` int NOT NULL AUTO_INCREMENT,
 
1324
  `b` int DEFAULT NULL,
1296
1325
  PRIMARY KEY (`a`),
1297
1326
  UNIQUE KEY `b` (`b`),
1298
1327
  CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`b`) REFERENCES `t1` (`id`),
1299
1328
  CONSTRAINT `t2_ibfk_2` FOREIGN KEY (`b`) REFERENCES `t1` (`id`)
1300
 
) ENGINE=InnoDB COLLATE = utf8_general_ci
 
1329
) ENGINE=InnoDB
1301
1330
drop table t2, t1;
1302
1331
create table t1 (c char(10), index (c,c)) engine=innodb;
1303
1332
ERROR 42S21: Duplicate column name 'c'
1394
1423
0
1395
1424
explain select count(*) from t1 where x > -16;
1396
1425
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
1397
 
1       SIMPLE  t1      index   PRIMARY PRIMARY 8       NULL    2       Using where; Using index
 
1426
1       SIMPLE  t1      range   PRIMARY PRIMARY 8       NULL    1       Using where; Using index
1398
1427
select count(*) from t1 where x > -16;
1399
1428
count(*)
1400
1429
2
1406
1435
count(*)
1407
1436
1
1408
1437
drop table t1;
1409
 
show status like "Innodb_buffer_pool_pages_total";
1410
 
Variable_name   Value
1411
 
show status like "Innodb_page_size";
1412
 
Variable_name   Value
1413
 
show status like "Innodb_rows_deleted";
1414
 
Variable_name   Value
1415
 
show status like "Innodb_rows_inserted";
1416
 
Variable_name   Value
1417
 
show status like "Innodb_rows_updated";
1418
 
Variable_name   Value
1419
 
show status like "Innodb_row_lock_waits";
1420
 
Variable_name   Value
1421
 
show status like "Innodb_row_lock_current_waits";
1422
 
Variable_name   Value
1423
 
show status like "Innodb_row_lock_time";
1424
 
Variable_name   Value
1425
 
show status like "Innodb_row_lock_time_max";
1426
 
Variable_name   Value
1427
 
show status like "Innodb_row_lock_time_avg";
1428
 
Variable_name   Value
1429
1438
show variables like "innodb_sync_spin_loops";
1430
1439
Variable_name   Value
1431
 
innodb_sync_spin_loops  30
 
1440
innodb_sync_spin_loops  20
1432
1441
set global innodb_sync_spin_loops=1000;
1433
1442
show variables like "innodb_sync_spin_loops";
1434
1443
Variable_name   Value
1446
1455
innodb_thread_concurrency       0
1447
1456
set global innodb_thread_concurrency=1001;
1448
1457
Warnings:
1449
 
Error   1524    Error setting innodb_thread_concurrency. Given value 1001 (> 1000)
 
1458
Error   1292    Truncated incorrect thread_concurrency value: '1001'
1450
1459
show variables like "innodb_thread_concurrency";
1451
1460
Variable_name   Value
1452
 
innodb_thread_concurrency       0
 
1461
innodb_thread_concurrency       1000
1453
1462
set global innodb_thread_concurrency=0;
1454
1463
show variables like "innodb_thread_concurrency";
1455
1464
Variable_name   Value
1467
1476
innodb_concurrency_tickets      1000
1468
1477
set global innodb_concurrency_tickets=0;
1469
1478
Warnings:
1470
 
Error   1524    Error setting innodb_concurrency_tickets. Given value 0 (< 1)
 
1479
Error   1292    Truncated incorrect concurrency_tickets value: '0'
1471
1480
show variables like "innodb_concurrency_tickets";
1472
1481
Variable_name   Value
1473
 
innodb_concurrency_tickets      1000
 
1482
innodb_concurrency_tickets      1
1474
1483
set global innodb_concurrency_tickets=500;
1475
1484
show variables like "innodb_concurrency_tickets";
1476
1485
Variable_name   Value
1498
1507
insert into t1 values('+ ', '+ ', '+ ');
1499
1508
set @a=repeat(' ',20);
1500
1509
insert into t1 values (concat('+',@a),concat('+',@a),concat('+',@a));
1501
 
ERROR 22001: Data too long for column 'v' at row 1
1502
 
set @a=repeat(' ',10);
1503
 
insert into t1 values (concat('+',@a),concat('+',@a),concat('+',@a));
1504
 
ERROR 22001: Data too long for column 'v' at row 1
1505
 
set @a=repeat(' ',9);
1506
 
insert into t1 values (concat('+',@a),concat('+',@a),concat('+',@a));
 
1510
Warnings:
 
1511
Note    1265    Data truncated for column 'v' at row 1
 
1512
Note    1265    Data truncated for column 'c' at row 1
1507
1513
select concat('*',v,'*',c,'*',t,'*') from t1;
1508
1514
concat('*',v,'*',c,'*',t,'*')
1509
1515
*+ *+ *+ *
1510
 
*+         *+         *+         *
 
1516
*+         *+         *+                    *
1511
1517
show create table t1;
1512
1518
Table   Create Table
1513
1519
t1      CREATE TABLE `t1` (
1514
 
  `v` VARCHAR(10) COLLATE utf8_general_ci DEFAULT NULL,
1515
 
  `c` VARCHAR(10) COLLATE utf8_general_ci DEFAULT NULL,
1516
 
  `t` TEXT COLLATE utf8_general_ci
1517
 
) ENGINE=InnoDB COLLATE = utf8_general_ci
 
1520
  `v` varchar(10) DEFAULT NULL,
 
1521
  `c` varchar(10) DEFAULT NULL,
 
1522
  `t` text
 
1523
) ENGINE=InnoDB
1518
1524
create  table t2 like t1;
1519
1525
show create table t2;
1520
1526
Table   Create Table
1521
1527
t2      CREATE TABLE `t2` (
1522
 
  `v` VARCHAR(10) COLLATE utf8_general_ci DEFAULT NULL,
1523
 
  `c` VARCHAR(10) COLLATE utf8_general_ci DEFAULT NULL,
1524
 
  `t` TEXT COLLATE utf8_general_ci
1525
 
) ENGINE=InnoDB COLLATE = utf8_general_ci
 
1528
  `v` varchar(10) DEFAULT NULL,
 
1529
  `c` varchar(10) DEFAULT NULL,
 
1530
  `t` text
 
1531
) ENGINE=InnoDB
1526
1532
create  table t3 select * from t1;
1527
1533
show create table t3;
1528
1534
Table   Create Table
1529
1535
t3      CREATE TABLE `t3` (
1530
 
  `v` VARCHAR(10) COLLATE utf8_general_ci DEFAULT NULL,
1531
 
  `c` VARCHAR(10) COLLATE utf8_general_ci DEFAULT NULL,
1532
 
  `t` TEXT COLLATE utf8_general_ci
1533
 
) ENGINE=InnoDB COLLATE = utf8_general_ci
 
1536
  `v` varchar(10) DEFAULT NULL,
 
1537
  `c` varchar(10) DEFAULT NULL,
 
1538
  `t` text
 
1539
) ENGINE=InnoDB
1534
1540
alter table t1 modify c varchar(10);
1535
1541
show create table t1;
1536
1542
Table   Create Table
1537
1543
t1      CREATE TABLE `t1` (
1538
 
  `v` VARCHAR(10) COLLATE utf8_general_ci DEFAULT NULL,
1539
 
  `c` VARCHAR(10) COLLATE utf8_general_ci DEFAULT NULL,
1540
 
  `t` TEXT COLLATE utf8_general_ci
1541
 
) ENGINE=InnoDB COLLATE = utf8_general_ci
 
1544
  `v` varchar(10) DEFAULT NULL,
 
1545
  `c` varchar(10) DEFAULT NULL,
 
1546
  `t` text
 
1547
) ENGINE=InnoDB
1542
1548
alter table t1 modify v char(10);
1543
1549
show create table t1;
1544
1550
Table   Create Table
1545
1551
t1      CREATE TABLE `t1` (
1546
 
  `v` VARCHAR(10) COLLATE utf8_general_ci DEFAULT NULL,
1547
 
  `c` VARCHAR(10) COLLATE utf8_general_ci DEFAULT NULL,
1548
 
  `t` TEXT COLLATE utf8_general_ci
1549
 
) ENGINE=InnoDB COLLATE = utf8_general_ci
 
1552
  `v` varchar(10) DEFAULT NULL,
 
1553
  `c` varchar(10) DEFAULT NULL,
 
1554
  `t` text
 
1555
) ENGINE=InnoDB
1550
1556
alter table t1 modify t varchar(10);
 
1557
Warnings:
 
1558
Note    1265    Data truncated for column 't' at row 2
1551
1559
show create table t1;
1552
1560
Table   Create Table
1553
1561
t1      CREATE TABLE `t1` (
1554
 
  `v` VARCHAR(10) COLLATE utf8_general_ci DEFAULT NULL,
1555
 
  `c` VARCHAR(10) COLLATE utf8_general_ci DEFAULT NULL,
1556
 
  `t` VARCHAR(10) COLLATE utf8_general_ci DEFAULT NULL
1557
 
) ENGINE=InnoDB COLLATE = utf8_general_ci
 
1562
  `v` varchar(10) DEFAULT NULL,
 
1563
  `c` varchar(10) DEFAULT NULL,
 
1564
  `t` varchar(10) DEFAULT NULL
 
1565
) ENGINE=InnoDB
1558
1566
select concat('*',v,'*',c,'*',t,'*') from t1;
1559
1567
concat('*',v,'*',c,'*',t,'*')
1560
1568
*+ *+ *+ *
1564
1572
show create table t1;
1565
1573
Table   Create Table
1566
1574
t1      CREATE TABLE `t1` (
1567
 
  `v` VARCHAR(10) COLLATE utf8_general_ci DEFAULT NULL,
1568
 
  `c` VARCHAR(10) COLLATE utf8_general_ci DEFAULT NULL,
1569
 
  `t` TEXT COLLATE utf8_general_ci,
 
1575
  `v` varchar(10) DEFAULT NULL,
 
1576
  `c` varchar(10) DEFAULT NULL,
 
1577
  `t` text,
1570
1578
  KEY `v` (`v`),
1571
1579
  KEY `c` (`c`),
1572
1580
  KEY `t` (`t`(10))
1573
 
) ENGINE=InnoDB COLLATE = utf8_general_ci
 
1581
) ENGINE=InnoDB
1574
1582
select count(*) from t1;
1575
1583
count(*)
1576
1584
270
1781
1789
i       10
1782
1790
alter table t1 modify v varchar(300), drop key v, drop key v_2, add key v (v);
1783
1791
Warnings:
1784
 
Warning 1071    Specified key was too long; max key length is 1023 bytes
 
1792
Warning 1071    Specified key was too long; max key length is 767 bytes
1785
1793
show create table t1;
1786
1794
Table   Create Table
1787
1795
t1      CREATE TABLE `t1` (
1788
 
  `v` VARCHAR(300) COLLATE utf8_general_ci DEFAULT NULL,
1789
 
  `c` VARCHAR(10) COLLATE utf8_general_ci DEFAULT NULL,
1790
 
  `t` TEXT COLLATE utf8_general_ci,
 
1796
  `v` varchar(300) DEFAULT NULL,
 
1797
  `c` varchar(10) DEFAULT NULL,
 
1798
  `t` text,
1791
1799
  KEY `c` (`c`),
1792
1800
  KEY `t` (`t`(10)),
1793
 
  KEY `v` (`v`(255))
1794
 
) ENGINE=InnoDB COLLATE = utf8_general_ci
 
1801
  KEY `v` (`v`(191))
 
1802
) ENGINE=InnoDB
1795
1803
select count(*) from t1 where v='a';
1796
1804
count(*)
1797
1805
10
1812
1820
9
1813
1821
explain select count(*) from t1 where v='a  ';
1814
1822
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
1815
 
1       SIMPLE  t1      ref     v       v       1023    const   #       Using where
 
1823
1       SIMPLE  t1      ref     v       v       767     const   #       Using where
1816
1824
explain select count(*) from t1 where v like 'a%';
1817
1825
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
1818
 
1       SIMPLE  t1      range   v       v       1023    NULL    #       Using where
 
1826
1       SIMPLE  t1      range   v       v       767     NULL    #       Using where
1819
1827
explain select count(*) from t1 where v between 'a' and 'a ';
1820
1828
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
1821
 
1       SIMPLE  t1      ref     v       v       1023    const   #       Using where
 
1829
1       SIMPLE  t1      ref     v       v       767     const   #       Using where
1822
1830
explain select count(*) from t1 where v between 'a' and 'a ' and v between 'a  ' and 'b\n';
1823
1831
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
1824
 
1       SIMPLE  t1      ref     v       v       1023    const   #       Using where
 
1832
1       SIMPLE  t1      ref     v       v       767     const   #       Using where
1825
1833
explain select * from t1 where v='a';
1826
1834
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
1827
 
1       SIMPLE  t1      ref     v       v       1023    const   #       Using where
 
1835
1       SIMPLE  t1      ref     v       v       767     const   #       Using where
1828
1836
select v,count(*) from t1 group by v limit 10;
1829
1837
v       count(*)
1830
1838
a      1
1865
1873
show create table t1;
1866
1874
Table   Create Table
1867
1875
t1      CREATE TABLE `t1` (
1868
 
  `v` VARCHAR(300) COLLATE utf8_general_ci DEFAULT NULL,
1869
 
  `c` VARCHAR(10) COLLATE utf8_general_ci DEFAULT NULL,
1870
 
  `t` TEXT COLLATE utf8_general_ci,
 
1876
  `v` varchar(300) DEFAULT NULL,
 
1877
  `c` varchar(10) DEFAULT NULL,
 
1878
  `t` text,
1871
1879
  KEY `c` (`c`),
1872
1880
  KEY `t` (`t`(10)),
1873
1881
  KEY `v` (`v`(30))
1874
 
) ENGINE=InnoDB COLLATE = utf8_general_ci
 
1882
) ENGINE=InnoDB
1875
1883
select count(*) from t1 where v='a';
1876
1884
count(*)
1877
1885
10
1943
1951
i       10
1944
1952
alter table t1 modify v varchar(600), drop key v, add key v (v);
1945
1953
Warnings:
1946
 
Warning 1071    Specified key was too long; max key length is 1023 bytes
 
1954
Warning 1071    Specified key was too long; max key length is 767 bytes
1947
1955
show create table t1;
1948
1956
Table   Create Table
1949
1957
t1      CREATE TABLE `t1` (
1950
 
  `v` VARCHAR(600) COLLATE utf8_general_ci DEFAULT NULL,
1951
 
  `c` VARCHAR(10) COLLATE utf8_general_ci DEFAULT NULL,
1952
 
  `t` TEXT COLLATE utf8_general_ci,
 
1958
  `v` varchar(600) DEFAULT NULL,
 
1959
  `c` varchar(10) DEFAULT NULL,
 
1960
  `t` text,
1953
1961
  KEY `c` (`c`),
1954
1962
  KEY `t` (`t`(10)),
1955
 
  KEY `v` (`v`(255))
1956
 
) ENGINE=InnoDB COLLATE = utf8_general_ci
 
1963
  KEY `v` (`v`(191))
 
1964
) ENGINE=InnoDB
1957
1965
select v,count(*) from t1 group by v limit 10;
1958
1966
v       count(*)
1959
1967
a      1
2001
2009
insert into t1 values ('a     ');
2002
2010
ERROR 23000: Duplicate entry 'a     ' for key 'a'
2003
2011
insert into t1 values ('a          ');
2004
 
ERROR 22001: Data too long for column 'a' at row 1
 
2012
ERROR 23000: Duplicate entry 'a         ' for key 'a'
2005
2013
insert into t1 values ('a ');
2006
2014
ERROR 23000: Duplicate entry 'a ' for key 'a'
2007
2015
update t1 set a='a  ' where a like 'a%';
2025
2033
show create table t1;
2026
2034
Table   Create Table
2027
2035
t1      CREATE TABLE `t1` (
2028
 
  `v` VARCHAR(10) COLLATE utf8_general_ci DEFAULT NULL,
2029
 
  `c` VARCHAR(10) COLLATE utf8_general_ci DEFAULT NULL,
2030
 
  `t` TEXT COLLATE utf8_general_ci,
 
2036
  `v` varchar(10) DEFAULT NULL,
 
2037
  `c` varchar(10) DEFAULT NULL,
 
2038
  `t` text,
2031
2039
  KEY `v` (`v`(5)),
2032
2040
  KEY `c` (`c`(5)),
2033
2041
  KEY `t` (`t`(5))
2034
 
) ENGINE=InnoDB COLLATE = utf8_general_ci
 
2042
) ENGINE=InnoDB
2035
2043
drop table t1;
2036
2044
create  table t1 (v char(10));
2037
2045
show create table t1;
2038
2046
Table   Create Table
2039
2047
t1      CREATE TABLE `t1` (
2040
 
  `v` VARCHAR(10) COLLATE utf8_general_ci DEFAULT NULL
2041
 
) ENGINE=InnoDB COLLATE = utf8_general_ci
 
2048
  `v` varchar(10) DEFAULT NULL
 
2049
) ENGINE=InnoDB
2042
2050
drop table t1;
2043
 
create  table t1 (v varchar(10), c char(10));
 
2051
create  table t1 (v varchar(10), c char(10)) row_format=fixed;
 
2052
Warnings:
 
2053
Warning 1478    InnoDB: assuming ROW_FORMAT=COMPACT.
2044
2054
show create table t1;
2045
2055
Table   Create Table
2046
2056
t1      CREATE TABLE `t1` (
2047
 
  `v` VARCHAR(10) COLLATE utf8_general_ci DEFAULT NULL,
2048
 
  `c` VARCHAR(10) COLLATE utf8_general_ci DEFAULT NULL
2049
 
) ENGINE=InnoDB COLLATE = utf8_general_ci
 
2057
  `v` varchar(10) DEFAULT NULL,
 
2058
  `c` varchar(10) DEFAULT NULL
 
2059
) ENGINE=InnoDB ROW_FORMAT=FIXED
2050
2060
insert into t1 values('a','a'),('a ','a ');
2051
2061
select concat('*',v,'*',c,'*') from t1;
2052
2062
concat('*',v,'*',c,'*')
2064
2074
drop table t1;
2065
2075
create table t1 (v varchar(16383), key(v));
2066
2076
Warnings:
2067
 
Warning 1071    Specified key was too long; max key length is 1023 bytes
2068
 
drop table t1;
2069
 
create table t1 (v varchar(16383));
2070
 
show create table t1;
2071
 
Table   Create Table
2072
 
t1      CREATE TABLE `t1` (
2073
 
  `v` VARCHAR(16383) COLLATE utf8_general_ci DEFAULT NULL
2074
 
) ENGINE=InnoDB COLLATE = utf8_general_ci
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
 
2077
Warning 1071    Specified key was too long; max key length is 767 bytes
 
2078
drop table t1;
 
2079
create table t1 (v varchar(16383));
 
2080
show create table t1;
 
2081
Table   Create Table
 
2082
t1      CREATE TABLE `t1` (
 
2083
  `v` varchar(16383) DEFAULT NULL
 
2084
) ENGINE=InnoDB
 
2085
drop table t1;
 
2086
create table t1 (v varchar(16383));
 
2087
show create table t1;
 
2088
Table   Create Table
 
2089
t1      CREATE TABLE `t1` (
 
2090
  `v` varchar(16383) DEFAULT NULL
 
2091
) ENGINE=InnoDB
2082
2092
drop table t1;
2083
2093
set storage_engine=InnoDB;
2084
2094
create table t1 (v varchar(16383)) engine=innodb;
2122
2132
3       1
2123
2133
4       2
2124
2134
drop table t1;
 
2135
create table t1 (a int not null auto_increment primary key, val int) engine=InnoDB;
 
2136
insert into t1 (val) values (1);
 
2137
update t1 set a=2 where a=1;
 
2138
insert into t1 (val) values (1);
 
2139
ERROR 23000: Duplicate entry '2' for key 'PRIMARY'
 
2140
select * from t1;
 
2141
a       val
 
2142
2       1
 
2143
drop table t1;
2125
2144
CREATE TABLE t1 (GRADE DECIMAL(4) NOT NULL, PRIMARY KEY (GRADE)) ENGINE=INNODB;
2126
2145
INSERT INTO t1 (GRADE) VALUES (151),(252),(343);
2127
2146
SELECT GRADE  FROM t1 WHERE GRADE > 160 AND GRADE < 300;
2169
2188
create table t1 (col1 varchar(2000), index (col1(767)))
2170
2189
engine = innodb;
2171
2190
Warnings:
2172
 
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
2173
2192
create table t2 (col1 char(255), index (col1))
2174
2193
engine = innodb;
 
2194
Warnings:
 
2195
Warning 1071    Specified key was too long; max key length is 767 bytes
2175
2196
create table t4 (col1 varchar(767), index (col1))
2176
2197
engine = innodb;
2177
2198
Warnings:
2178
 
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
2179
2200
create table t5 (col1 varchar(190) primary key)
2180
2201
engine = innodb;
2181
2202
create table t6 (col1 varbinary(254) primary key)
2183
2204
create table t7 (col1 text, index(col1(767)))
2184
2205
engine = innodb;
2185
2206
Warnings:
2186
 
Warning 1071    Specified key was too long; max key length is 1023 bytes
 
2207
Warning 1071    Specified key was too long; max key length is 767 bytes
2187
2208
create table t8 (col1 blob, index(col1(767)))
2188
2209
engine = innodb;
2189
2210
create table t9 (col1 varchar(512), col2 varchar(512), index(col1, col2))
2190
2211
engine = innodb;
2191
2212
Warnings:
2192
 
Warning 1071    Specified key was too long; max key length is 1023 bytes
2193
 
Warning 1071    Specified key was too long; max key length is 1023 bytes
 
2213
Warning 1071    Specified key was too long; max key length is 767 bytes
 
2214
Warning 1071    Specified key was too long; max key length is 767 bytes
2194
2215
show create table t9;
2195
2216
Table   Create Table
2196
2217
t9      CREATE TABLE `t9` (
2197
 
  `col1` VARCHAR(512) COLLATE utf8_general_ci DEFAULT NULL,
2198
 
  `col2` VARCHAR(512) COLLATE utf8_general_ci DEFAULT NULL,
2199
 
  KEY `col1` (`col1`(255),`col2`(255))
2200
 
) ENGINE=InnoDB COLLATE = utf8_general_ci
 
2218
  `col1` varchar(512) DEFAULT NULL,
 
2219
  `col2` varchar(512) DEFAULT NULL,
 
2220
  KEY `col1` (`col1`(191),`col2`(191))
 
2221
) ENGINE=InnoDB
2201
2222
drop table t1, t2, t4, t5, t6, t7, t8, t9;
2202
2223
create table t1 (col1 varchar(768), index(col1))
2203
2224
engine = innodb;
2204
2225
Warnings:
2205
 
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
2206
2227
create table t2 (col1 varbinary(768), index(col1))
2207
2228
engine = innodb;
 
2229
Warnings:
 
2230
Warning 1071    Specified key was too long; max key length is 767 bytes
2208
2231
create table t3 (col1 text, index(col1(768)))
2209
2232
engine = innodb;
2210
2233
Warnings:
2211
 
Warning 1071    Specified key was too long; max key length is 1023 bytes
 
2234
Warning 1071    Specified key was too long; max key length is 767 bytes
2212
2235
create table t4 (col1 blob, index(col1(768)))
2213
2236
engine = innodb;
 
2237
Warnings:
 
2238
Warning 1071    Specified key was too long; max key length is 767 bytes
2214
2239
show create table t1;
2215
2240
Table   Create Table
2216
2241
t1      CREATE TABLE `t1` (
2217
 
  `col1` VARCHAR(768) COLLATE utf8_general_ci DEFAULT NULL,
2218
 
  KEY `col1` (`col1`(255))
2219
 
) ENGINE=InnoDB COLLATE = utf8_general_ci
 
2242
  `col1` varchar(768) DEFAULT NULL,
 
2243
  KEY `col1` (`col1`(191))
 
2244
) ENGINE=InnoDB
2220
2245
drop table t1, t2, t3, t4;
2221
2246
create table t1 (col1 varchar(768) primary key)
2222
2247
engine = innodb;
2223
 
ERROR 42000: Specified key was too long; max key length is 1023 bytes
2224
 
create table t2 (col1 varbinary(1024) primary key)
 
2248
ERROR 42000: Specified key was too long; max key length is 767 bytes
 
2249
create table t2 (col1 varbinary(768) primary key)
2225
2250
engine = innodb;
2226
 
ERROR 42000: Specified key was too long; max key length is 1023 bytes
 
2251
ERROR 42000: Specified key was too long; max key length is 767 bytes
2227
2252
create table t3 (col1 text, primary key(col1(768)))
2228
2253
engine = innodb;
2229
 
ERROR 42000: Specified key was too long; max key length is 1023 bytes
2230
 
create table t4 (col1 blob, primary key(col1(1024)))
 
2254
ERROR 42000: Specified key was too long; max key length is 767 bytes
 
2255
create table t4 (col1 blob, primary key(col1(768)))
2231
2256
engine = innodb;
2232
 
ERROR 42000: Specified key was too long; max key length is 1023 bytes
 
2257
ERROR 42000: Specified key was too long; max key length is 767 bytes
2233
2258
CREATE TABLE t1
2234
2259
(
2235
2260
id INT PRIMARY KEY
2253
2278
INSERT INTO t2 VALUES(3);
2254
2279
ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `c1` FOREIGN KEY (`v`) REFERENCES `t1` (`id`))
2255
2280
DROP TABLE t2;
 
2281
create table t1(a int not null) engine=innodb;
 
2282
insert into t1 values (1),(2);
 
2283
set autocommit=0;
 
2284
checksum table t1;
 
2285
Table   Checksum
 
2286
test.t1 1531596814
 
2287
insert into t1 values(3);
 
2288
checksum table t1;
 
2289
Table   Checksum
 
2290
test.t1 1531596814
 
2291
commit;
 
2292
checksum table t1;
 
2293
Table   Checksum
 
2294
test.t1 2050879373
 
2295
commit;
 
2296
drop table t1;
 
2297
create table t1(a int not null) engine=innodb;
 
2298
insert into t1 values (1),(2);
 
2299
set autocommit=1;
 
2300
checksum table t1;
 
2301
Table   Checksum
 
2302
test.t1 1531596814
 
2303
set autocommit=1;
 
2304
insert into t1 values(3);
 
2305
checksum table t1;
 
2306
Table   Checksum
 
2307
test.t1 2050879373
 
2308
drop table t1;
2256
2309
set foreign_key_checks=0;
2257
2310
create table t2 (a int primary key, b int, foreign key (b) references t1(a)) engine = innodb;
2258
2311
create table t1(a char(10) primary key, b varchar(20)) engine = innodb;
2299
2352
b varchar(255),
2300
2353
c varchar(255),
2301
2354
d varchar(255),
2302
 
key (a(200),b(200),c(200),d(200))) engine=innodb;
 
2355
key (a,b,c,d)) engine=innodb;
 
2356
Warnings:
 
2357
Warning 1071    Specified key was too long; max key length is 767 bytes
 
2358
Warning 1071    Specified key was too long; max key length is 767 bytes
 
2359
Warning 1071    Specified key was too long; max key length is 767 bytes
 
2360
Warning 1071    Specified key was too long; max key length is 767 bytes
2303
2361
drop table t1;
2304
2362
create table t1 (a varchar(255),
2305
2363
b varchar(255),
2309
2367
key (a,b,c,d,e)) engine=innodb;
2310
2368
ERROR 42000: Specified key was too long; max key length is 3500 bytes
2311
2369
create table t1 (s1 varbinary(2),primary key (s1)) engine=innodb;
2312
 
create table t3 (s1 varchar(2) ,primary key (s1)) engine=innodb;
2313
 
create table t4 (s1 char(2) ,primary key (s1)) engine=innodb;
 
2370
create table t3 (s1 varchar(2) binary,primary key (s1)) engine=innodb;
 
2371
create table t4 (s1 char(2) binary,primary key (s1)) engine=innodb;
2314
2372
insert into t1 values (0x41),(0x4120),(0x4100);
2315
2373
insert into t3 values (0x41),(0x4120),(0x4100);
2316
2374
ERROR 23000: Duplicate entry 'A ' for key 'PRIMARY'
2379
2437
4120
2380
2438
4120
2381
2439
drop table t2,t1;
2382
 
create table t1 (a int primary key,s1 varchar(2) not null unique) engine=innodb;
2383
 
create table t2 (s1 char(2) not null, constraint c foreign key(s1) references t1(s1) on update cascade) engine=innodb;
 
2440
create table t1 (a int primary key,s1 varchar(2) binary not null unique) engine=innodb;
 
2441
create table t2 (s1 char(2) binary not null, constraint c foreign key(s1) references t1(s1) on update cascade) engine=innodb;
2384
2442
insert into t1 values(1,0x4100),(2,0x41);
2385
2443
insert into t2 values(0x41);
2386
2444
select hex(s1) from t2;
2413
2471
SHOW CREATE TABLE t2;
2414
2472
Table   Create Table
2415
2473
t2      CREATE TABLE `t2` (
2416
 
  `a` INT DEFAULT NULL,
 
2474
  `a` int DEFAULT NULL,
2417
2475
  KEY `t2_ibfk_0` (`a`)
2418
 
) ENGINE=InnoDB COLLATE = utf8_general_ci
 
2476
) ENGINE=InnoDB
2419
2477
DROP TABLE t2,t1;
2420
2478
CREATE TABLE t1 (
2421
2479
field1 varchar(8) NOT NULL DEFAULT '',
2450
2508
show create table t1;
2451
2509
Table   Create Table
2452
2510
t1      CREATE TABLE `t1` (
2453
 
  `c1` BIGINT NOT NULL,
2454
 
  `c2` BIGINT NOT NULL,
 
2511
  `c1` bigint NOT NULL,
 
2512
  `c2` bigint NOT NULL,
2455
2513
  PRIMARY KEY (`c1`),
2456
2514
  UNIQUE KEY `c2` (`c2`),
2457
2515
  CONSTRAINT `c2_fk` FOREIGN KEY (`c2`) REFERENCES `t2` (`c1`) ON DELETE CASCADE
2458
 
) ENGINE=InnoDB COLLATE = utf8_general_ci
 
2516
) ENGINE=InnoDB
2459
2517
alter table t1 drop foreign key c2_fk;
2460
2518
show create table t1;
2461
2519
Table   Create Table
2462
2520
t1      CREATE TABLE `t1` (
2463
 
  `c1` BIGINT NOT NULL,
2464
 
  `c2` BIGINT NOT NULL,
 
2521
  `c1` bigint NOT NULL,
 
2522
  `c2` bigint NOT NULL,
2465
2523
  PRIMARY KEY (`c1`),
2466
2524
  UNIQUE KEY `c2` (`c2`)
2467
 
) ENGINE=InnoDB COLLATE = utf8_general_ci
 
2525
) ENGINE=InnoDB
2468
2526
drop table t1, t2;
2469
2527
create table t1(a date) engine=innodb;
2470
2528
create table t2(a date, key(a)) engine=innodb;
2601
2659
commit;
2602
2660
drop table t1, t2, t3, t5, t6, t8, t9;
2603
2661
CREATE TABLE t1 (DB_ROW_ID int) engine=innodb;
2604
 
Got one of the listed errors
 
2662
ERROR HY000: Can't create table 'test.t1' (errno: -1)
2605
2663
CREATE TABLE t1 (
2606
2664
a BIGINT NOT NULL,
2607
2665
PRIMARY KEY  (a)
2615
2673
CONSTRAINT t_fk FOREIGN KEY (a) REFERENCES t1 (a) 
2616
2674
ON DELETE CASCADE
2617
2675
) ENGINE=INNODB;
 
2676
Warnings:
 
2677
Warning 1071    Specified key was too long; max key length is 767 bytes
2618
2678
INSERT INTO t1 VALUES (1);
2619
2679
INSERT INTO t2 VALUES (1, 'bar', 'vbar');
2620
2680
INSERT INTO t2 VALUES (1, 'BAR2', 'VBAR');
2640
2700
CREATE TABLE t1 ( a int ) ENGINE=innodb;
2641
2701
BEGIN;
2642
2702
INSERT INTO t1 VALUES (1);
2643
 
ALTER TABLE t1 ENGINE=innodb;
 
2703
OPTIMIZE TABLE t1;
 
2704
Table   Op      Msg_type        Msg_text
 
2705
test.t1 optimize        status  OK
2644
2706
DROP TABLE t1;
2645
2707
CREATE TABLE t1 (id int PRIMARY KEY, f int NOT NULL, INDEX(f)) ENGINE=InnoDB;
2646
2708
CREATE TABLE t2 (id int PRIMARY KEY, f INT NOT NULL,
2651
2713
SHOW CREATE TABLE t2;
2652
2714
Table   Create Table
2653
2715
t2      CREATE TABLE `t2` (
2654
 
  `id` INT NOT NULL,
2655
 
  `f` INT NOT NULL,
 
2716
  `id` int NOT NULL,
 
2717
  `f` int NOT NULL,
2656
2718
  PRIMARY KEY (`id`),
2657
2719
  KEY `f` (`f`),
2658
 
  CONSTRAINT `t2_t1` FOREIGN KEY (`id`) REFERENCES `t1` (`id`) ON UPDATE CASCADE ON DELETE CASCADE,
2659
 
  CONSTRAINT `t2_ibfk_2` FOREIGN KEY (`f`) REFERENCES `t1` (`f`) ON UPDATE CASCADE ON DELETE CASCADE
2660
 
) ENGINE=InnoDB COLLATE = utf8_general_ci
 
2720
  CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`f`) REFERENCES `t1` (`f`) ON DELETE CASCADE ON UPDATE CASCADE,
 
2721
  CONSTRAINT `t2_t1` FOREIGN KEY (`id`) REFERENCES `t1` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
 
2722
) ENGINE=InnoDB
2661
2723
DROP TABLE t2, t1;
2662
2724
CREATE TABLE t1 (a INT, INDEX(a)) ENGINE=InnoDB;
2663
2725
CREATE TABLE t2 (a INT, INDEX(a)) ENGINE=InnoDB;
2665
2727
INSERT INTO t2 VALUES (1);
2666
2728
ALTER TABLE t2 ADD FOREIGN KEY (a) REFERENCES t1 (a) ON DELETE SET NULL;
2667
2729
ALTER TABLE t2 MODIFY a INT NOT NULL;
2668
 
ERROR HY000: Error on rename of '#sql-temporary' to 'test.t2' (errno: 150)
 
2730
ERROR HY000: Error on rename of '#sql-temporary' to './test/t2' (errno: 150)
2669
2731
DELETE FROM t1;
2670
2732
DROP TABLE t2,t1;
2671
2733
CREATE TABLE t1 (a VARCHAR(5) COLLATE utf8_unicode_ci PRIMARY KEY)
2688
2750
SHOW CREATE TABLE t1;
2689
2751
Table   Create Table
2690
2752
t1      CREATE TABLE `t1` (
2691
 
  `id` INT NOT NULL AUTO_INCREMENT,
 
2753
  `id` int NOT NULL AUTO_INCREMENT,
2692
2754
  PRIMARY KEY (`id`)
2693
 
) ENGINE=InnoDB COLLATE = utf8_general_ci AUTO_INCREMENT=42
 
2755
) ENGINE=InnoDB
2694
2756
CREATE TABLE t2 (id int PRIMARY KEY) ENGINE=InnoDB;
2695
2757
INSERT INTO t2 VALUES(42),(347),(348);
2696
2758
ALTER TABLE t1 ADD CONSTRAINT t1_t2 FOREIGN KEY (id) REFERENCES t2(id);
2697
2759
SHOW CREATE TABLE t1;
2698
2760
Table   Create Table
2699
2761
t1      CREATE TABLE `t1` (
2700
 
  `id` INT NOT NULL AUTO_INCREMENT,
 
2762
  `id` int NOT NULL AUTO_INCREMENT,
2701
2763
  PRIMARY KEY (`id`),
2702
2764
  CONSTRAINT `t1_t2` FOREIGN KEY (`id`) REFERENCES `t2` (`id`)
2703
 
) ENGINE=InnoDB COLLATE = utf8_general_ci
 
2765
) ENGINE=InnoDB
2704
2766
DROP TABLE t1,t2;
2705
2767
DROP TABLE IF EXISTS t1;
2706
2768
Warnings:
2718
2780
-10
2719
2781
1
2720
2782
DROP TABLE t1;
2721
 
SET GLOBAL innodb_lock_wait_timeout=@orig_lock_wait_timeout ;