mirror of
https://github.com/MariaDB/server.git
synced 2025-11-21 06:21:35 +03:00
Merge with 5.2.
no_error handling for select (used by INSERT ... SELECT) still needs to be fixed, but I will do that in a separate commit
This commit is contained in:
@@ -1,3 +1,121 @@
|
||||
set global innodb_file_per_table=on;
|
||||
set global innodb_file_format='Barracuda';
|
||||
CREATE TABLE t1_purge (
|
||||
A INT,
|
||||
B BLOB, C BLOB, D BLOB, E BLOB,
|
||||
F BLOB, G BLOB, H BLOB,
|
||||
PRIMARY KEY (B(767), C(767), D(767), E(767), A),
|
||||
INDEX (A)
|
||||
) ENGINE=InnoDB ROW_FORMAT=DYNAMIC;
|
||||
INSERT INTO t1_purge VALUES (1,
|
||||
REPEAT('b', 766), REPEAT('c', 766), REPEAT('d', 766), REPEAT('e', 766),
|
||||
REPEAT('f', 766), REPEAT('g', 766), REPEAT('h', 766));
|
||||
CREATE TABLE t2_purge (
|
||||
A INT PRIMARY KEY,
|
||||
B BLOB, C BLOB, D BLOB, E BLOB,
|
||||
F BLOB, G BLOB, H BLOB, I BLOB,
|
||||
J BLOB, K BLOB, L BLOB,
|
||||
INDEX (B(767))) ENGINE=InnoDB ROW_FORMAT=DYNAMIC;
|
||||
INSERT INTO t2_purge VALUES (1,
|
||||
REPEAT('b', 766), REPEAT('c', 766), REPEAT('d', 766), REPEAT('e', 766),
|
||||
REPEAT('f', 766), REPEAT('g', 766), REPEAT('h', 766), REPEAT('i', 766),
|
||||
REPEAT('j', 766), REPEAT('k', 766), REPEAT('l', 766));
|
||||
CREATE TABLE t3_purge (
|
||||
A INT,
|
||||
B VARCHAR(800), C VARCHAR(800), D VARCHAR(800), E VARCHAR(800),
|
||||
F VARCHAR(800), G VARCHAR(800), H VARCHAR(800),
|
||||
PRIMARY KEY (B(767), C(767), D(767), E(767), A),
|
||||
INDEX (A)
|
||||
) ENGINE=InnoDB ROW_FORMAT=DYNAMIC;
|
||||
INSERT INTO t3_purge SELECT * FROM t1_purge;
|
||||
CREATE TABLE t4_purge (
|
||||
A INT PRIMARY KEY,
|
||||
B VARCHAR(800), C VARCHAR(800), D VARCHAR(800), E VARCHAR(800),
|
||||
F VARCHAR(800), G VARCHAR(800), H VARCHAR(800), I VARCHAR(800),
|
||||
J VARCHAR(800), K VARCHAR(800), L VARCHAR(800),
|
||||
INDEX (B(767))) ENGINE=InnoDB ROW_FORMAT=DYNAMIC;
|
||||
INSERT INTO t4_purge SELECT * FROM t2_purge;
|
||||
DELETE FROM t1_purge;
|
||||
DELETE FROM t2_purge;
|
||||
DELETE FROM t3_purge;
|
||||
DELETE FROM t4_purge;
|
||||
SET @r=REPEAT('a',500);
|
||||
CREATE TABLE t12637786(a INT,
|
||||
v1 VARCHAR(500), v2 VARCHAR(500), v3 VARCHAR(500),
|
||||
v4 VARCHAR(500), v5 VARCHAR(500), v6 VARCHAR(500),
|
||||
v7 VARCHAR(500), v8 VARCHAR(500), v9 VARCHAR(500),
|
||||
v10 VARCHAR(500), v11 VARCHAR(500), v12 VARCHAR(500),
|
||||
v13 VARCHAR(500), v14 VARCHAR(500), v15 VARCHAR(500),
|
||||
v16 VARCHAR(500), v17 VARCHAR(500), v18 VARCHAR(500)
|
||||
) ENGINE=InnoDB ROW_FORMAT=DYNAMIC;
|
||||
CREATE INDEX idx1 ON t12637786(a,v1);
|
||||
INSERT INTO t12637786 VALUES(9,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r);
|
||||
UPDATE t12637786 SET a=1000;
|
||||
DELETE FROM t12637786;
|
||||
create table t12963823(a blob,b blob,c blob,d blob,e blob,f blob,g blob,h blob,
|
||||
i blob,j blob,k blob,l blob,m blob,n blob,o blob,p blob)
|
||||
engine=innodb row_format=dynamic;
|
||||
SET @r = repeat('a', 767);
|
||||
insert into t12963823 values (@r,@r,@r,@r, @r,@r,@r,@r, @r,@r,@r,@r, @r,@r,@r,@r);
|
||||
create index ndx_a on t12963823 (a(500));
|
||||
create index ndx_b on t12963823 (b(500));
|
||||
create index ndx_c on t12963823 (c(500));
|
||||
create index ndx_d on t12963823 (d(500));
|
||||
create index ndx_e on t12963823 (e(500));
|
||||
create index ndx_f on t12963823 (f(500));
|
||||
create index ndx_k on t12963823 (k(500));
|
||||
create index ndx_l on t12963823 (l(500));
|
||||
SET @r = repeat('b', 500);
|
||||
update t12963823 set a=@r,b=@r,c=@r,d=@r;
|
||||
update t12963823 set e=@r,f=@r,g=@r,h=@r;
|
||||
update t12963823 set i=@r,j=@r,k=@r,l=@r;
|
||||
update t12963823 set m=@r,n=@r,o=@r,p=@r;
|
||||
alter table t12963823 drop index ndx_a;
|
||||
alter table t12963823 drop index ndx_b;
|
||||
create index ndx_g on t12963823 (g(500));
|
||||
create index ndx_h on t12963823 (h(500));
|
||||
create index ndx_i on t12963823 (i(500));
|
||||
create index ndx_j on t12963823 (j(500));
|
||||
create index ndx_m on t12963823 (m(500));
|
||||
create index ndx_n on t12963823 (n(500));
|
||||
create index ndx_o on t12963823 (o(500));
|
||||
create index ndx_p on t12963823 (p(500));
|
||||
show create table t12963823;
|
||||
Table Create Table
|
||||
t12963823 CREATE TABLE `t12963823` (
|
||||
`a` blob,
|
||||
`b` blob,
|
||||
`c` blob,
|
||||
`d` blob,
|
||||
`e` blob,
|
||||
`f` blob,
|
||||
`g` blob,
|
||||
`h` blob,
|
||||
`i` blob,
|
||||
`j` blob,
|
||||
`k` blob,
|
||||
`l` blob,
|
||||
`m` blob,
|
||||
`n` blob,
|
||||
`o` blob,
|
||||
`p` blob,
|
||||
KEY `ndx_c` (`c`(500)),
|
||||
KEY `ndx_d` (`d`(500)),
|
||||
KEY `ndx_e` (`e`(500)),
|
||||
KEY `ndx_f` (`f`(500)),
|
||||
KEY `ndx_k` (`k`(500)),
|
||||
KEY `ndx_l` (`l`(500)),
|
||||
KEY `ndx_g` (`g`(500)),
|
||||
KEY `ndx_h` (`h`(500)),
|
||||
KEY `ndx_i` (`i`(500)),
|
||||
KEY `ndx_j` (`j`(500)),
|
||||
KEY `ndx_m` (`m`(500)),
|
||||
KEY `ndx_n` (`n`(500)),
|
||||
KEY `ndx_o` (`o`(500)),
|
||||
KEY `ndx_p` (`p`(500))
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC
|
||||
set global innodb_file_per_table=0;
|
||||
set global innodb_file_format=Antelope;
|
||||
create table t1(a int not null, b int, c char(10) not null, d varchar(20)) engine = innodb;
|
||||
insert into t1 values (5,5,'oo','oo'),(4,4,'tr','tr'),(3,4,'ad','ad'),(2,3,'ak','ak');
|
||||
commit;
|
||||
@@ -967,6 +1085,29 @@ ERROR HY000: Too big row
|
||||
alter table t1 row_format=compact;
|
||||
create index t1u on t1 (u(1));
|
||||
drop table t1;
|
||||
CREATE TABLE bug12547647(
|
||||
a INT NOT NULL, b BLOB NOT NULL, c TEXT,
|
||||
PRIMARY KEY (b(10), a), INDEX (c(10))
|
||||
) ENGINE=InnoDB ROW_FORMAT=DYNAMIC;
|
||||
INSERT INTO bug12547647 VALUES (5,repeat('khdfo5AlOq',1900),repeat('g',7731));
|
||||
COMMIT;
|
||||
UPDATE bug12547647 SET c = REPEAT('b',16928);
|
||||
ERROR 42000: Row size too large. The maximum row size for the used table type, not counting BLOBs, is 8126. You have to change some columns to TEXT or BLOBs
|
||||
DROP TABLE bug12547647;
|
||||
SET @r=REPEAT('a',500);
|
||||
CREATE TABLE t1(a INT,
|
||||
v1 VARCHAR(500), v2 VARCHAR(500), v3 VARCHAR(500),
|
||||
v4 VARCHAR(500), v5 VARCHAR(500), v6 VARCHAR(500),
|
||||
v7 VARCHAR(500), v8 VARCHAR(500), v9 VARCHAR(500),
|
||||
v10 VARCHAR(500), v11 VARCHAR(500), v12 VARCHAR(500),
|
||||
v13 VARCHAR(500), v14 VARCHAR(500), v15 VARCHAR(500),
|
||||
v16 VARCHAR(500), v17 VARCHAR(500), v18 VARCHAR(500)
|
||||
) ENGINE=InnoDB ROW_FORMAT=DYNAMIC;
|
||||
CREATE INDEX idx1 ON t1(a,v1);
|
||||
INSERT INTO t1 VALUES(9,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r);
|
||||
UPDATE t1 SET a=1000;
|
||||
DELETE FROM t1;
|
||||
DROP TABLE t1;
|
||||
set global innodb_file_per_table=0;
|
||||
set global innodb_file_format=Antelope;
|
||||
set global innodb_file_format_check=Antelope;
|
||||
@@ -1170,3 +1311,6 @@ a b
|
||||
3 a
|
||||
3 b
|
||||
DROP TABLE t1;
|
||||
DROP TABLE t1_purge, t2_purge, t3_purge, t4_purge;
|
||||
DROP TABLE t12637786;
|
||||
DROP TABLE t12963823;
|
||||
|
||||
@@ -55,3 +55,20 @@ id x
|
||||
1 1
|
||||
2 10
|
||||
drop table t1;
|
||||
#
|
||||
#Bug#12842206 INNODB LOCKING REGRESSION FOR INSERT IGNORE
|
||||
#fixed by re-fixing Bug#7975
|
||||
#aka Bug#11759688 52020: InnoDB can still deadlock on just INSERT...
|
||||
#
|
||||
CREATE TABLE t1 (a INT PRIMARY KEY, b INT NOT NULL) ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES(3,1);
|
||||
BEGIN;
|
||||
INSERT IGNORE INTO t1 VALUES(3,14);
|
||||
BEGIN;
|
||||
INSERT IGNORE INTO t1 VALUES(3,23);
|
||||
SELECT * FROM t1 FOR UPDATE;
|
||||
COMMIT;
|
||||
a b
|
||||
3 1
|
||||
COMMIT;
|
||||
DROP TABLE t1;
|
||||
|
||||
@@ -62,42 +62,42 @@ row_format=compressed;
|
||||
create table t14(a int primary key) engine=innodb key_block_size=9;
|
||||
Warnings:
|
||||
Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=9.
|
||||
SELECT table_schema, table_name, row_format
|
||||
SELECT table_schema, table_name, row_format, data_length, index_length
|
||||
FROM information_schema.tables WHERE engine='innodb';
|
||||
table_schema table_name row_format
|
||||
test t0 Compact
|
||||
test t00 Compact
|
||||
test t1 Compact
|
||||
test t10 Dynamic
|
||||
test t11 Compressed
|
||||
test t12 Compressed
|
||||
test t13 Compressed
|
||||
test t14 Compact
|
||||
test t2 Redundant
|
||||
test t3 Compact
|
||||
test t4 Compact
|
||||
test t5 Redundant
|
||||
test t6 Redundant
|
||||
test t7 Redundant
|
||||
test t8 Compact
|
||||
test t9 Compact
|
||||
table_schema table_name row_format data_length index_length
|
||||
test t0 Compact 16384 0
|
||||
test t00 Compact 16384 0
|
||||
test t1 Compact 16384 0
|
||||
test t10 Dynamic 16384 0
|
||||
test t11 Compressed 1024 0
|
||||
test t12 Compressed 1024 0
|
||||
test t13 Compressed 8192 0
|
||||
test t14 Compact 16384 0
|
||||
test t2 Redundant 16384 0
|
||||
test t3 Compact 16384 0
|
||||
test t4 Compact 16384 0
|
||||
test t5 Redundant 16384 0
|
||||
test t6 Redundant 16384 0
|
||||
test t7 Redundant 16384 0
|
||||
test t8 Compact 16384 0
|
||||
test t9 Compact 16384 0
|
||||
drop table t0,t00,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14;
|
||||
alter table t1 key_block_size=0;
|
||||
alter table t1 row_format=dynamic;
|
||||
SELECT table_schema, table_name, row_format
|
||||
SELECT table_schema, table_name, row_format, data_length, index_length
|
||||
FROM information_schema.tables WHERE engine='innodb';
|
||||
table_schema table_name row_format
|
||||
test t1 Dynamic
|
||||
table_schema table_name row_format data_length index_length
|
||||
test t1 Dynamic 16384 0
|
||||
alter table t1 row_format=compact;
|
||||
SELECT table_schema, table_name, row_format
|
||||
SELECT table_schema, table_name, row_format, data_length, index_length
|
||||
FROM information_schema.tables WHERE engine='innodb';
|
||||
table_schema table_name row_format
|
||||
test t1 Compact
|
||||
table_schema table_name row_format data_length index_length
|
||||
test t1 Compact 16384 0
|
||||
alter table t1 row_format=redundant;
|
||||
SELECT table_schema, table_name, row_format
|
||||
SELECT table_schema, table_name, row_format, data_length, index_length
|
||||
FROM information_schema.tables WHERE engine='innodb';
|
||||
table_schema table_name row_format
|
||||
test t1 Redundant
|
||||
table_schema table_name row_format data_length index_length
|
||||
test t1 Redundant 16384 0
|
||||
drop table t1;
|
||||
create table t1(a int not null, b text, index(b(10))) engine=innodb
|
||||
key_block_size=1;
|
||||
@@ -114,11 +114,11 @@ rollback;
|
||||
select a,left(b,40) from t1 natural join t2;
|
||||
a left(b,40)
|
||||
1 1abcdefghijklmnopqrstuvwxyzAAAAAAAAAAAAA
|
||||
SELECT table_schema, table_name, row_format
|
||||
SELECT table_schema, table_name, row_format, data_length, index_length
|
||||
FROM information_schema.tables WHERE engine='innodb';
|
||||
table_schema table_name row_format
|
||||
test t1 Compressed
|
||||
test t2 Compact
|
||||
table_schema table_name row_format data_length index_length
|
||||
test t1 Compressed 2048 1024
|
||||
test t2 Compact 16384 0
|
||||
drop table t1,t2;
|
||||
SET SESSION innodb_strict_mode = off;
|
||||
CREATE TABLE t1(
|
||||
@@ -206,19 +206,19 @@ create table t8 (id int primary key) engine = innodb row_format = compressed;
|
||||
create table t9 (id int primary key) engine = innodb row_format = dynamic;
|
||||
create table t10(id int primary key) engine = innodb row_format = compact;
|
||||
create table t11(id int primary key) engine = innodb row_format = redundant;
|
||||
SELECT table_schema, table_name, row_format
|
||||
SELECT table_schema, table_name, row_format, data_length, index_length
|
||||
FROM information_schema.tables WHERE engine='innodb';
|
||||
table_schema table_name row_format
|
||||
test t1 Compact
|
||||
test t10 Compact
|
||||
test t11 Redundant
|
||||
test t3 Compressed
|
||||
test t4 Compressed
|
||||
test t5 Compressed
|
||||
test t6 Compressed
|
||||
test t7 Compressed
|
||||
test t8 Compressed
|
||||
test t9 Dynamic
|
||||
table_schema table_name row_format data_length index_length
|
||||
test t1 Compact 16384 0
|
||||
test t10 Compact 16384 0
|
||||
test t11 Redundant 16384 0
|
||||
test t3 Compressed 1024 0
|
||||
test t4 Compressed 2048 0
|
||||
test t5 Compressed 4096 0
|
||||
test t6 Compressed 8192 0
|
||||
test t7 Compressed 16384 0
|
||||
test t8 Compressed 8192 0
|
||||
test t9 Dynamic 16384 0
|
||||
drop table t1, t3, t4, t5, t6, t7, t8, t9, t10, t11;
|
||||
create table t1 (id int primary key) engine = innodb
|
||||
key_block_size = 8 row_format = compressed;
|
||||
@@ -245,11 +245,11 @@ Warning 1478 InnoDB: cannot specify ROW_FORMAT = DYNAMIC with KEY_BLOCK_SIZE.
|
||||
Error 1005 Can't create table 'test.t4' (errno: 1478)
|
||||
create table t5 (id int primary key) engine = innodb
|
||||
key_block_size = 8 row_format = default;
|
||||
SELECT table_schema, table_name, row_format
|
||||
SELECT table_schema, table_name, row_format, data_length, index_length
|
||||
FROM information_schema.tables WHERE engine='innodb';
|
||||
table_schema table_name row_format
|
||||
test t1 Compressed
|
||||
test t5 Compressed
|
||||
table_schema table_name row_format data_length index_length
|
||||
test t1 Compressed 8192 0
|
||||
test t5 Compressed 8192 0
|
||||
drop table t1, t5;
|
||||
create table t1 (id int primary key) engine = innodb
|
||||
key_block_size = 9 row_format = redundant;
|
||||
@@ -275,9 +275,9 @@ Level Code Message
|
||||
Warning 1478 InnoDB: invalid KEY_BLOCK_SIZE = 9. Valid values are [1, 2, 4, 8, 16]
|
||||
Warning 1478 InnoDB: cannot specify ROW_FORMAT = DYNAMIC with KEY_BLOCK_SIZE.
|
||||
Error 1005 Can't create table 'test.t2' (errno: 1478)
|
||||
SELECT table_schema, table_name, row_format
|
||||
SELECT table_schema, table_name, row_format, data_length, index_length
|
||||
FROM information_schema.tables WHERE engine='innodb';
|
||||
table_schema table_name row_format
|
||||
table_schema table_name row_format data_length index_length
|
||||
set global innodb_file_per_table = off;
|
||||
create table t1 (id int primary key) engine = innodb key_block_size = 1;
|
||||
ERROR HY000: Can't create table 'test.t1' (errno: 1478)
|
||||
@@ -323,11 +323,11 @@ Warning 1478 InnoDB: ROW_FORMAT=DYNAMIC requires innodb_file_per_table.
|
||||
Error 1005 Can't create table 'test.t7' (errno: 1478)
|
||||
create table t8 (id int primary key) engine = innodb row_format = compact;
|
||||
create table t9 (id int primary key) engine = innodb row_format = redundant;
|
||||
SELECT table_schema, table_name, row_format
|
||||
SELECT table_schema, table_name, row_format, data_length, index_length
|
||||
FROM information_schema.tables WHERE engine='innodb';
|
||||
table_schema table_name row_format
|
||||
test t8 Compact
|
||||
test t9 Redundant
|
||||
table_schema table_name row_format data_length index_length
|
||||
test t8 Compact 16384 0
|
||||
test t9 Redundant 16384 0
|
||||
drop table t8, t9;
|
||||
set global innodb_file_per_table = on;
|
||||
set global innodb_file_format = `0`;
|
||||
@@ -375,11 +375,11 @@ Warning 1478 InnoDB: ROW_FORMAT=DYNAMIC requires innodb_file_format > Antelope.
|
||||
Error 1005 Can't create table 'test.t7' (errno: 1478)
|
||||
create table t8 (id int primary key) engine = innodb row_format = compact;
|
||||
create table t9 (id int primary key) engine = innodb row_format = redundant;
|
||||
SELECT table_schema, table_name, row_format
|
||||
SELECT table_schema, table_name, row_format, data_length, index_length
|
||||
FROM information_schema.tables WHERE engine='innodb';
|
||||
table_schema table_name row_format
|
||||
test t8 Compact
|
||||
test t9 Redundant
|
||||
table_schema table_name row_format data_length index_length
|
||||
test t8 Compact 16384 0
|
||||
test t9 Redundant 16384 0
|
||||
drop table t8, t9;
|
||||
set global innodb_file_per_table=0;
|
||||
set global innodb_file_format=Antelope;
|
||||
|
||||
@@ -1302,6 +1302,20 @@ ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fail
|
||||
update t3 set t3.id=7 where t1.id =1 and t2.id = t1.id and t3.id = t2.id;
|
||||
ERROR 42S22: Unknown column 't1.id' in 'where clause'
|
||||
drop table t3,t2,t1;
|
||||
CREATE TABLE t1 (
|
||||
c1 VARCHAR(8), c2 VARCHAR(8),
|
||||
PRIMARY KEY (c1, c2)
|
||||
) ENGINE=InnoDB;
|
||||
CREATE TABLE t2 (
|
||||
c0 INT PRIMARY KEY,
|
||||
c1 VARCHAR(8) UNIQUE,
|
||||
FOREIGN KEY (c1) REFERENCES t1 (c1) ON UPDATE CASCADE
|
||||
) ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES ('old', 'somevalu'), ('other', 'anyvalue');
|
||||
INSERT INTO t2 VALUES (10, 'old'), (20, 'other');
|
||||
UPDATE t1 SET c1 = 'other' WHERE c1 = 'old';
|
||||
ERROR 23000: Upholding foreign key constraints for table 't1', entry 'other-somevalu', key 2 would lead to a duplicate entry
|
||||
DROP TABLE t2,t1;
|
||||
create table t1(
|
||||
id int primary key,
|
||||
pid int,
|
||||
@@ -1680,7 +1694,7 @@ variable_value - @innodb_rows_deleted_orig
|
||||
71
|
||||
SELECT variable_value - @innodb_rows_inserted_orig FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_rows_inserted';
|
||||
variable_value - @innodb_rows_inserted_orig
|
||||
1067
|
||||
1071
|
||||
SELECT variable_value - @innodb_rows_updated_orig FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_rows_updated';
|
||||
variable_value - @innodb_rows_updated_orig
|
||||
866
|
||||
|
||||
@@ -126,5 +126,4 @@ Warning 1265 Data truncated for column 'col79' at row 1
|
||||
Warning 1264 Out of range value for column 'col84' at row 1
|
||||
DROP TABLE bug52745;
|
||||
SET GLOBAL innodb_file_format=Antelope;
|
||||
SET GLOBAL innodb_file_format_check=Antelope;
|
||||
SET GLOBAL innodb_file_per_table=0;
|
||||
|
||||
@@ -11,5 +11,4 @@ Error 139 Too big row
|
||||
Error 1118 Row size too large. The maximum row size for the used table type, not counting BLOBs, is 8126. You have to change some columns to TEXT or BLOBs
|
||||
DROP TABLE bug53591;
|
||||
SET GLOBAL innodb_file_format=Antelope;
|
||||
SET GLOBAL innodb_file_format_check=Antelope;
|
||||
SET GLOBAL innodb_file_per_table=0;
|
||||
|
||||
17
mysql-test/suite/innodb_plugin/r/innodb_bug59410.result
Normal file
17
mysql-test/suite/innodb_plugin/r/innodb_bug59410.result
Normal file
@@ -0,0 +1,17 @@
|
||||
create table `bug59410_1`(`a` int)engine=innodb;
|
||||
insert into `bug59410_1` values (1),(2),(3);
|
||||
select 1 from `bug59410_1` where `a` <> any (
|
||||
select 1 from `bug59410_1` where `a` <> 1 for update)
|
||||
for update;
|
||||
1
|
||||
1
|
||||
1
|
||||
drop table bug59410_1;
|
||||
create table bug59410_2(`a` char(1),`b` int)engine=innodb;
|
||||
insert into bug59410_2 values('0',0);
|
||||
set transaction isolation level read uncommitted;
|
||||
start transaction;
|
||||
set @a=(select b from bug59410_2 where
|
||||
(select 1 from bug59410_2 where a group by @a=b)
|
||||
group by @a:=b);
|
||||
drop table bug59410_2;
|
||||
59
mysql-test/suite/innodb_plugin/r/innodb_bug59641.result
Normal file
59
mysql-test/suite/innodb_plugin/r/innodb_bug59641.result
Normal file
@@ -0,0 +1,59 @@
|
||||
flush tables;
|
||||
CREATE TABLE t(a INT PRIMARY KEY, b INT)ENGINE=InnoDB;
|
||||
INSERT INTO t VALUES(2,2),(4,4),(8,8),(16,16),(32,32);
|
||||
COMMIT;
|
||||
XA START '123';
|
||||
INSERT INTO t VALUES(1,1);
|
||||
XA END '123';
|
||||
XA PREPARE '123';
|
||||
XA START '456';
|
||||
INSERT INTO t VALUES(3,47),(5,67);
|
||||
UPDATE t SET b=2*b WHERE a BETWEEN 5 AND 8;
|
||||
XA END '456';
|
||||
XA PREPARE '456';
|
||||
XA START '789';
|
||||
UPDATE t SET b=4*a WHERE a=32;
|
||||
XA END '789';
|
||||
XA PREPARE '789';
|
||||
call mtr.add_suppression("Found 3 prepared XA transactions");
|
||||
FLUSH TABLES;
|
||||
SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
|
||||
SELECT * FROM t;
|
||||
a b
|
||||
1 1
|
||||
2 2
|
||||
3 47
|
||||
4 4
|
||||
5 134
|
||||
8 16
|
||||
16 16
|
||||
32 128
|
||||
COMMIT;
|
||||
SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
|
||||
SELECT * FROM t;
|
||||
a b
|
||||
1 1
|
||||
2 2
|
||||
3 47
|
||||
4 4
|
||||
5 134
|
||||
8 16
|
||||
16 16
|
||||
32 128
|
||||
COMMIT;
|
||||
XA RECOVER;
|
||||
formatID gtrid_length bqual_length data
|
||||
1 3 0 789
|
||||
1 3 0 456
|
||||
1 3 0 123
|
||||
XA ROLLBACK '123';
|
||||
XA ROLLBACK '456';
|
||||
XA COMMIT '789';
|
||||
SELECT * FROM t;
|
||||
a b
|
||||
2 2
|
||||
4 4
|
||||
8 8
|
||||
16 16
|
||||
32 128
|
||||
DROP TABLE t;
|
||||
@@ -0,0 +1,13 @@
|
||||
set global innodb_file_per_table=on;
|
||||
set global innodb_file_format=`1`;
|
||||
create table t1(a text) engine=innodb key_block_size=8;
|
||||
SELECT page_size FROM information_schema.innodb_cmpmem WHERE pages_used > 0;
|
||||
page_size
|
||||
8192
|
||||
drop table t1;
|
||||
SELECT page_size FROM information_schema.innodb_cmpmem WHERE pages_used > 0;
|
||||
page_size
|
||||
create table t2(a text) engine=innodb;
|
||||
SELECT page_size FROM information_schema.innodb_cmpmem WHERE pages_used > 0;
|
||||
page_size
|
||||
drop table t2;
|
||||
@@ -572,7 +572,7 @@ COUNT(*)
|
||||
EXPLAIN
|
||||
SELECT COUNT(*) FROM t2 WHERE p=POINTFROMTEXT('POINT(1 2)');
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t2 ref p p 28 const 1 Using where
|
||||
1 SIMPLE t2 ref p p 28 const # Using where
|
||||
SELECT COUNT(*) FROM t2 WHERE p=POINTFROMTEXT('POINT(1 2)');
|
||||
COUNT(*)
|
||||
2
|
||||
|
||||
882
mysql-test/suite/innodb_plugin/r/innodb_misc1.result
Normal file
882
mysql-test/suite/innodb_plugin/r/innodb_misc1.result
Normal file
@@ -0,0 +1,882 @@
|
||||
drop table if exists t1,t2,t3,t4;
|
||||
drop database if exists mysqltest;
|
||||
create table t1 (v varchar(16384)) engine=innodb;
|
||||
drop table t1;
|
||||
create table t1 (a char(1), b char(1), key(a, b)) engine=innodb;
|
||||
insert into t1 values ('8', '6'), ('4', '7');
|
||||
select min(a) from t1;
|
||||
min(a)
|
||||
4
|
||||
select min(b) from t1 where a='8';
|
||||
min(b)
|
||||
6
|
||||
drop table t1;
|
||||
CREATE TABLE t1 ( `a` int(11) NOT NULL auto_increment, `b` int(11) default NULL,PRIMARY KEY (`a`),UNIQUE KEY `b` (`b`)) ENGINE=innodb;
|
||||
insert into t1 (b) values (1);
|
||||
replace into t1 (b) values (2), (1), (3);
|
||||
select * from t1;
|
||||
a b
|
||||
3 1
|
||||
2 2
|
||||
4 3
|
||||
truncate table t1;
|
||||
insert into t1 (b) values (1);
|
||||
replace into t1 (b) values (2);
|
||||
replace into t1 (b) values (1);
|
||||
replace into t1 (b) values (3);
|
||||
select * from t1;
|
||||
a b
|
||||
3 1
|
||||
2 2
|
||||
4 3
|
||||
drop table t1;
|
||||
create table t1 (rowid int not null auto_increment, val int not null,primary
|
||||
key (rowid), unique(val)) engine=innodb;
|
||||
replace into t1 (val) values ('1'),('2');
|
||||
replace into t1 (val) values ('1'),('2');
|
||||
insert into t1 (val) values ('1'),('2');
|
||||
ERROR 23000: Duplicate entry '1' for key 'val'
|
||||
select * from t1;
|
||||
rowid val
|
||||
3 1
|
||||
4 2
|
||||
drop table t1;
|
||||
create table t1 (a int not null auto_increment primary key, val int) engine=InnoDB;
|
||||
insert into t1 (val) values (1);
|
||||
update t1 set a=2 where a=1;
|
||||
insert into t1 (val) values (1);
|
||||
ERROR 23000: Duplicate entry '2' for key 'PRIMARY'
|
||||
select * from t1;
|
||||
a val
|
||||
2 1
|
||||
drop table t1;
|
||||
CREATE TABLE t1 (GRADE DECIMAL(4) NOT NULL, PRIMARY KEY (GRADE)) ENGINE=INNODB;
|
||||
INSERT INTO t1 (GRADE) VALUES (151),(252),(343);
|
||||
SELECT GRADE FROM t1 WHERE GRADE > 160 AND GRADE < 300;
|
||||
GRADE
|
||||
252
|
||||
SELECT GRADE FROM t1 WHERE GRADE= 151;
|
||||
GRADE
|
||||
151
|
||||
DROP TABLE t1;
|
||||
create table t1 (f1 varchar(10), f2 varchar(10), primary key (f1,f2)) engine=innodb;
|
||||
create table t2 (f3 varchar(10), f4 varchar(10), key (f4)) engine=innodb;
|
||||
insert into t2 values ('aa','cc');
|
||||
insert into t1 values ('aa','bb'),('aa','cc');
|
||||
delete t1 from t1,t2 where f1=f3 and f4='cc';
|
||||
select * from t1;
|
||||
f1 f2
|
||||
drop table t1,t2;
|
||||
CREATE TABLE t1 (
|
||||
id INTEGER NOT NULL AUTO_INCREMENT, PRIMARY KEY (id)
|
||||
) ENGINE=InnoDB;
|
||||
CREATE TABLE t2 (
|
||||
id INTEGER NOT NULL,
|
||||
FOREIGN KEY (id) REFERENCES t1 (id)
|
||||
) ENGINE=InnoDB;
|
||||
INSERT INTO t1 (id) VALUES (NULL);
|
||||
SELECT * FROM t1;
|
||||
id
|
||||
1
|
||||
TRUNCATE t1;
|
||||
INSERT INTO t1 (id) VALUES (NULL);
|
||||
SELECT * FROM t1;
|
||||
id
|
||||
1
|
||||
DELETE FROM t1;
|
||||
TRUNCATE t1;
|
||||
INSERT INTO t1 (id) VALUES (NULL);
|
||||
SELECT * FROM t1;
|
||||
id
|
||||
1
|
||||
DROP TABLE t2, t1;
|
||||
CREATE TABLE t1
|
||||
(
|
||||
id INT PRIMARY KEY
|
||||
) ENGINE=InnoDB;
|
||||
CREATE TEMPORARY TABLE t2
|
||||
(
|
||||
id INT NOT NULL PRIMARY KEY,
|
||||
b INT,
|
||||
FOREIGN KEY (b) REFERENCES test.t1(id)
|
||||
) ENGINE=InnoDB;
|
||||
Got one of the listed errors
|
||||
DROP TABLE t1;
|
||||
create table t1 (col1 varchar(2000), index (col1(767)))
|
||||
character set = latin1 engine = innodb;
|
||||
create table t2 (col1 char(255), index (col1))
|
||||
character set = latin1 engine = innodb;
|
||||
create table t3 (col1 binary(255), index (col1))
|
||||
character set = latin1 engine = innodb;
|
||||
create table t4 (col1 varchar(767), index (col1))
|
||||
character set = latin1 engine = innodb;
|
||||
create table t5 (col1 varchar(767) primary key)
|
||||
character set = latin1 engine = innodb;
|
||||
create table t6 (col1 varbinary(767) primary key)
|
||||
character set = latin1 engine = innodb;
|
||||
create table t7 (col1 text, index(col1(767)))
|
||||
character set = latin1 engine = innodb;
|
||||
create table t8 (col1 blob, index(col1(767)))
|
||||
character set = latin1 engine = innodb;
|
||||
create table t9 (col1 varchar(512), col2 varchar(512), index(col1, col2))
|
||||
character set = latin1 engine = innodb;
|
||||
show create table t9;
|
||||
Table Create Table
|
||||
t9 CREATE TABLE `t9` (
|
||||
`col1` varchar(512) DEFAULT NULL,
|
||||
`col2` varchar(512) DEFAULT NULL,
|
||||
KEY `col1` (`col1`,`col2`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1
|
||||
drop table t1, t2, t3, t4, t5, t6, t7, t8, t9;
|
||||
create table t1 (col1 varchar(768), index(col1))
|
||||
character set = latin1 engine = innodb;
|
||||
Warnings:
|
||||
Warning 1071 Specified key was too long; max key length is 767 bytes
|
||||
create table t2 (col1 varbinary(768), index(col1))
|
||||
character set = latin1 engine = innodb;
|
||||
Warnings:
|
||||
Warning 1071 Specified key was too long; max key length is 767 bytes
|
||||
create table t3 (col1 text, index(col1(768)))
|
||||
character set = latin1 engine = innodb;
|
||||
Warnings:
|
||||
Warning 1071 Specified key was too long; max key length is 767 bytes
|
||||
create table t4 (col1 blob, index(col1(768)))
|
||||
character set = latin1 engine = innodb;
|
||||
Warnings:
|
||||
Warning 1071 Specified key was too long; max key length is 767 bytes
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`col1` varchar(768) DEFAULT NULL,
|
||||
KEY `col1` (`col1`(767))
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1
|
||||
drop table t1, t2, t3, t4;
|
||||
create table t1 (col1 varchar(768) primary key)
|
||||
character set = latin1 engine = innodb;
|
||||
ERROR 42000: Specified key was too long; max key length is 767 bytes
|
||||
create table t2 (col1 varbinary(768) primary key)
|
||||
character set = latin1 engine = innodb;
|
||||
ERROR 42000: Specified key was too long; max key length is 767 bytes
|
||||
create table t3 (col1 text, primary key(col1(768)))
|
||||
character set = latin1 engine = innodb;
|
||||
ERROR 42000: Specified key was too long; max key length is 767 bytes
|
||||
create table t4 (col1 blob, primary key(col1(768)))
|
||||
character set = latin1 engine = innodb;
|
||||
ERROR 42000: Specified key was too long; max key length is 767 bytes
|
||||
CREATE TABLE t1
|
||||
(
|
||||
id INT PRIMARY KEY
|
||||
) ENGINE=InnoDB;
|
||||
CREATE TABLE t2
|
||||
(
|
||||
v INT,
|
||||
CONSTRAINT c1 FOREIGN KEY (v) REFERENCES t1(id)
|
||||
) ENGINE=InnoDB;
|
||||
INSERT INTO t2 VALUES(2);
|
||||
ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `c1` FOREIGN KEY (`v`) REFERENCES `t1` (`id`))
|
||||
INSERT INTO t1 VALUES(1);
|
||||
INSERT INTO t2 VALUES(1);
|
||||
DELETE FROM t1 WHERE id = 1;
|
||||
ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `c1` FOREIGN KEY (`v`) REFERENCES `t1` (`id`))
|
||||
DROP TABLE t1;
|
||||
ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails
|
||||
SET FOREIGN_KEY_CHECKS=0;
|
||||
DROP TABLE t1;
|
||||
SET FOREIGN_KEY_CHECKS=1;
|
||||
INSERT INTO t2 VALUES(3);
|
||||
ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `c1` FOREIGN KEY (`v`) REFERENCES `t1` (`id`))
|
||||
DROP TABLE t2;
|
||||
create table t1(a int not null) engine=innodb DEFAULT CHARSET=latin1;
|
||||
insert into t1 values (1),(2);
|
||||
set autocommit=0;
|
||||
checksum table t1;
|
||||
Table Checksum
|
||||
test.t1 1531596814
|
||||
insert into t1 values(3);
|
||||
checksum table t1;
|
||||
Table Checksum
|
||||
test.t1 1531596814
|
||||
commit;
|
||||
checksum table t1;
|
||||
Table Checksum
|
||||
test.t1 2050879373
|
||||
commit;
|
||||
drop table t1;
|
||||
create table t1(a int not null) engine=innodb DEFAULT CHARSET=latin1;
|
||||
insert into t1 values (1),(2);
|
||||
set autocommit=1;
|
||||
checksum table t1;
|
||||
Table Checksum
|
||||
test.t1 1531596814
|
||||
set autocommit=1;
|
||||
insert into t1 values(3);
|
||||
checksum table t1;
|
||||
Table Checksum
|
||||
test.t1 2050879373
|
||||
drop table t1;
|
||||
set foreign_key_checks=0;
|
||||
create table t2 (a int primary key, b int, foreign key (b) references t1(a)) engine = innodb;
|
||||
create table t1(a char(10) primary key, b varchar(20)) engine = innodb;
|
||||
ERROR HY000: Can't create table 'test.t1' (errno: 150)
|
||||
set foreign_key_checks=1;
|
||||
drop table t2;
|
||||
set foreign_key_checks=0;
|
||||
create table t1(a varchar(10) primary key) engine = innodb DEFAULT CHARSET=latin1;
|
||||
create table t2 (a varchar(10), foreign key (a) references t1(a)) engine = innodb DEFAULT CHARSET=utf8;
|
||||
ERROR HY000: Can't create table 'test.t2' (errno: 150)
|
||||
set foreign_key_checks=1;
|
||||
drop table t1;
|
||||
set foreign_key_checks=0;
|
||||
create table t2 (a varchar(10), foreign key (a) references t1(a)) engine = innodb;
|
||||
create table t1(a varchar(10) primary key) engine = innodb;
|
||||
alter table t1 modify column a int;
|
||||
Got one of the listed errors
|
||||
set foreign_key_checks=1;
|
||||
drop table t2,t1;
|
||||
set foreign_key_checks=0;
|
||||
create table t2 (a varchar(10), foreign key (a) references t1(a)) engine = innodb DEFAULT CHARSET=latin1;
|
||||
create table t1(a varchar(10) primary key) engine = innodb DEFAULT CHARSET=latin1;
|
||||
alter table t1 convert to character set utf8;
|
||||
set foreign_key_checks=1;
|
||||
drop table t2,t1;
|
||||
set foreign_key_checks=0;
|
||||
create table t2 (a varchar(10), foreign key (a) references t1(a)) engine = innodb DEFAULT CHARSET=latin1;
|
||||
create table t3(a varchar(10) primary key) engine = innodb DEFAULT CHARSET=utf8;
|
||||
rename table t3 to t1;
|
||||
ERROR HY000: Error on rename of './test/t3' to './test/t1' (errno: 150)
|
||||
set foreign_key_checks=1;
|
||||
drop table t2,t3;
|
||||
create table t1(a int primary key) row_format=redundant engine=innodb;
|
||||
create table t2(a int primary key,constraint foreign key(a)references t1(a)) row_format=compact engine=innodb;
|
||||
create table t3(a int primary key) row_format=compact engine=innodb;
|
||||
create table t4(a int primary key,constraint foreign key(a)references t3(a)) row_format=redundant engine=innodb;
|
||||
insert into t1 values(1);
|
||||
insert into t3 values(1);
|
||||
insert into t2 values(2);
|
||||
ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`a`) REFERENCES `t1` (`a`))
|
||||
insert into t4 values(2);
|
||||
ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`t4`, CONSTRAINT `t4_ibfk_1` FOREIGN KEY (`a`) REFERENCES `t3` (`a`))
|
||||
insert into t2 values(1);
|
||||
insert into t4 values(1);
|
||||
update t1 set a=2;
|
||||
ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`a`) REFERENCES `t1` (`a`))
|
||||
update t2 set a=2;
|
||||
ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`a`) REFERENCES `t1` (`a`))
|
||||
update t3 set a=2;
|
||||
ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t4`, CONSTRAINT `t4_ibfk_1` FOREIGN KEY (`a`) REFERENCES `t3` (`a`))
|
||||
update t4 set a=2;
|
||||
ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`t4`, CONSTRAINT `t4_ibfk_1` FOREIGN KEY (`a`) REFERENCES `t3` (`a`))
|
||||
truncate t1;
|
||||
ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`a`) REFERENCES `t1` (`a`))
|
||||
truncate t3;
|
||||
ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t4`, CONSTRAINT `t4_ibfk_1` FOREIGN KEY (`a`) REFERENCES `t3` (`a`))
|
||||
truncate t2;
|
||||
truncate t4;
|
||||
truncate t1;
|
||||
truncate t3;
|
||||
drop table t4,t3,t2,t1;
|
||||
create table t1 (a varchar(255) character set utf8,
|
||||
b varchar(255) character set utf8,
|
||||
c varchar(255) character set utf8,
|
||||
d varchar(255) character set utf8,
|
||||
key (a,b,c,d)) engine=innodb;
|
||||
drop table t1;
|
||||
create table t1 (a varchar(255) character set utf8,
|
||||
b varchar(255) character set utf8,
|
||||
c varchar(255) character set utf8,
|
||||
d varchar(255) character set utf8,
|
||||
e varchar(255) character set utf8,
|
||||
key (a,b,c,d,e)) engine=innodb;
|
||||
ERROR 42000: Specified key was too long; max key length is 3072 bytes
|
||||
create table t1 (s1 varbinary(2),primary key (s1)) engine=innodb;
|
||||
create table t2 (s1 binary(2),primary key (s1)) engine=innodb;
|
||||
create table t3 (s1 varchar(2) binary,primary key (s1)) engine=innodb;
|
||||
create table t4 (s1 char(2) binary,primary key (s1)) engine=innodb;
|
||||
insert into t1 values (0x41),(0x4120),(0x4100);
|
||||
insert into t2 values (0x41),(0x4120),(0x4100);
|
||||
ERROR 23000: Duplicate entry 'A' for key 'PRIMARY'
|
||||
insert into t2 values (0x41),(0x4120);
|
||||
insert into t3 values (0x41),(0x4120),(0x4100);
|
||||
ERROR 23000: Duplicate entry 'A ' for key 'PRIMARY'
|
||||
insert into t3 values (0x41),(0x4100);
|
||||
insert into t4 values (0x41),(0x4120),(0x4100);
|
||||
ERROR 23000: Duplicate entry 'A' for key 'PRIMARY'
|
||||
insert into t4 values (0x41),(0x4100);
|
||||
select hex(s1) from t1;
|
||||
hex(s1)
|
||||
41
|
||||
4100
|
||||
4120
|
||||
select hex(s1) from t2;
|
||||
hex(s1)
|
||||
4100
|
||||
4120
|
||||
select hex(s1) from t3;
|
||||
hex(s1)
|
||||
4100
|
||||
41
|
||||
select hex(s1) from t4;
|
||||
hex(s1)
|
||||
4100
|
||||
41
|
||||
drop table t1,t2,t3,t4;
|
||||
create table t1 (a int primary key,s1 varbinary(3) not null unique) engine=innodb;
|
||||
create table t2 (s1 binary(2) not null, constraint c foreign key(s1) references t1(s1) on update cascade) engine=innodb;
|
||||
insert into t1 values(1,0x4100),(2,0x41),(3,0x4120),(4,0x42);
|
||||
insert into t2 values(0x42);
|
||||
ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `c` FOREIGN KEY (`s1`) REFERENCES `t1` (`s1`) ON UPDATE CASCADE)
|
||||
insert into t2 values(0x41);
|
||||
select hex(s1) from t2;
|
||||
hex(s1)
|
||||
4100
|
||||
update t1 set s1=0x123456 where a=2;
|
||||
select hex(s1) from t2;
|
||||
hex(s1)
|
||||
4100
|
||||
update t1 set s1=0x12 where a=1;
|
||||
ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `c` FOREIGN KEY (`s1`) REFERENCES `t1` (`s1`) ON UPDATE CASCADE)
|
||||
update t1 set s1=0x12345678 where a=1;
|
||||
ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `c` FOREIGN KEY (`s1`) REFERENCES `t1` (`s1`) ON UPDATE CASCADE)
|
||||
update t1 set s1=0x123457 where a=1;
|
||||
ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `c` FOREIGN KEY (`s1`) REFERENCES `t1` (`s1`) ON UPDATE CASCADE)
|
||||
update t1 set s1=0x1220 where a=1;
|
||||
select hex(s1) from t2;
|
||||
hex(s1)
|
||||
1220
|
||||
update t1 set s1=0x1200 where a=1;
|
||||
select hex(s1) from t2;
|
||||
hex(s1)
|
||||
1200
|
||||
update t1 set s1=0x4200 where a=1;
|
||||
select hex(s1) from t2;
|
||||
hex(s1)
|
||||
4200
|
||||
delete from t1 where a=1;
|
||||
ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `c` FOREIGN KEY (`s1`) REFERENCES `t1` (`s1`) ON UPDATE CASCADE)
|
||||
delete from t1 where a=2;
|
||||
update t2 set s1=0x4120;
|
||||
delete from t1;
|
||||
ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `c` FOREIGN KEY (`s1`) REFERENCES `t1` (`s1`) ON UPDATE CASCADE)
|
||||
delete from t1 where a!=3;
|
||||
select a,hex(s1) from t1;
|
||||
a hex(s1)
|
||||
3 4120
|
||||
select hex(s1) from t2;
|
||||
hex(s1)
|
||||
4120
|
||||
drop table t2,t1;
|
||||
create table t1 (a int primary key,s1 varchar(2) binary not null unique) engine=innodb;
|
||||
create table t2 (s1 char(2) binary not null, constraint c foreign key(s1) references t1(s1) on update cascade) engine=innodb;
|
||||
insert into t1 values(1,0x4100),(2,0x41);
|
||||
insert into t2 values(0x41);
|
||||
select hex(s1) from t2;
|
||||
hex(s1)
|
||||
41
|
||||
update t1 set s1=0x1234 where a=1;
|
||||
select hex(s1) from t2;
|
||||
hex(s1)
|
||||
41
|
||||
update t1 set s1=0x12 where a=2;
|
||||
select hex(s1) from t2;
|
||||
hex(s1)
|
||||
12
|
||||
delete from t1 where a=1;
|
||||
delete from t1 where a=2;
|
||||
ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `c` FOREIGN KEY (`s1`) REFERENCES `t1` (`s1`) ON UPDATE CASCADE)
|
||||
select a,hex(s1) from t1;
|
||||
a hex(s1)
|
||||
2 12
|
||||
select hex(s1) from t2;
|
||||
hex(s1)
|
||||
12
|
||||
drop table t2,t1;
|
||||
CREATE TABLE t1(a INT, PRIMARY KEY(a)) ENGINE=InnoDB;
|
||||
CREATE TABLE t2(a INT) ENGINE=InnoDB;
|
||||
ALTER TABLE t2 ADD FOREIGN KEY (a) REFERENCES t1(a);
|
||||
ALTER TABLE t2 DROP FOREIGN KEY t2_ibfk_1;
|
||||
ALTER TABLE t2 ADD CONSTRAINT t2_ibfk_0 FOREIGN KEY (a) REFERENCES t1(a);
|
||||
ALTER TABLE t2 DROP FOREIGN KEY t2_ibfk_0;
|
||||
SHOW CREATE TABLE t2;
|
||||
Table Create Table
|
||||
t2 CREATE TABLE `t2` (
|
||||
`a` int(11) DEFAULT NULL,
|
||||
KEY `t2_ibfk_0` (`a`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1
|
||||
DROP TABLE t2,t1;
|
||||
create table t1(a int not null, b int, c int, d int, primary key(a)) engine=innodb;
|
||||
insert into t1(a) values (1),(2),(3);
|
||||
commit;
|
||||
set autocommit = 0;
|
||||
update t1 set b = 5 where a = 2;
|
||||
create trigger t1t before insert on t1 for each row begin set NEW.b = NEW.a * 10 + 5, NEW.c = NEW.a / 10; end |
|
||||
set autocommit = 0;
|
||||
insert into t1(a) values (10),(20),(30),(40),(50),(60),(70),(80),(90),(100),
|
||||
(11),(21),(31),(41),(51),(61),(71),(81),(91),(101),
|
||||
(12),(22),(32),(42),(52),(62),(72),(82),(92),(102),
|
||||
(13),(23),(33),(43),(53),(63),(73),(83),(93),(103),
|
||||
(14),(24),(34),(44),(54),(64),(74),(84),(94),(104);
|
||||
commit;
|
||||
commit;
|
||||
drop trigger t1t;
|
||||
drop table t1;
|
||||
create table t1(a int not null, b int, c int, d int, primary key(a)) engine=innodb;
|
||||
create table t2(a int not null, b int, c int, d int, primary key(a)) engine=innodb;
|
||||
create table t3(a int not null, b int, c int, d int, primary key(a)) engine=innodb;
|
||||
create table t4(a int not null, b int, c int, d int, primary key(a)) engine=innodb;
|
||||
create table t5(a int not null, b int, c int, d int, primary key(a)) engine=innodb;
|
||||
insert into t1(a) values (1),(2),(3);
|
||||
insert into t2(a) values (1),(2),(3);
|
||||
insert into t3(a) values (1),(2),(3);
|
||||
insert into t4(a) values (1),(2),(3);
|
||||
insert into t3(a) values (5),(7),(8);
|
||||
insert into t4(a) values (5),(7),(8);
|
||||
insert into t5(a) values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12);
|
||||
create trigger t1t before insert on t1 for each row begin
|
||||
INSERT INTO t2 SET a = NEW.a;
|
||||
end |
|
||||
create trigger t2t before insert on t2 for each row begin
|
||||
DELETE FROM t3 WHERE a = NEW.a;
|
||||
end |
|
||||
create trigger t3t before delete on t3 for each row begin
|
||||
UPDATE t4 SET b = b + 1 WHERE a = OLD.a;
|
||||
end |
|
||||
create trigger t4t before update on t4 for each row begin
|
||||
UPDATE t5 SET b = b + 1 where a = NEW.a;
|
||||
end |
|
||||
commit;
|
||||
set autocommit = 0;
|
||||
update t1 set b = b + 5 where a = 1;
|
||||
update t2 set b = b + 5 where a = 1;
|
||||
update t3 set b = b + 5 where a = 1;
|
||||
update t4 set b = b + 5 where a = 1;
|
||||
insert into t5(a) values(20);
|
||||
set autocommit = 0;
|
||||
insert into t1(a) values(7);
|
||||
insert into t2(a) values(8);
|
||||
delete from t2 where a = 3;
|
||||
update t4 set b = b + 1 where a = 3;
|
||||
commit;
|
||||
drop trigger t1t;
|
||||
drop trigger t2t;
|
||||
drop trigger t3t;
|
||||
drop trigger t4t;
|
||||
drop table t1, t2, t3, t4, t5;
|
||||
CREATE TABLE t1 (
|
||||
field1 varchar(8) NOT NULL DEFAULT '',
|
||||
field2 varchar(8) NOT NULL DEFAULT '',
|
||||
PRIMARY KEY (field1, field2)
|
||||
) ENGINE=InnoDB;
|
||||
CREATE TABLE t2 (
|
||||
field1 varchar(8) NOT NULL DEFAULT '' PRIMARY KEY,
|
||||
FOREIGN KEY (field1) REFERENCES t1 (field1)
|
||||
ON DELETE CASCADE ON UPDATE CASCADE
|
||||
) ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES ('old', 'somevalu');
|
||||
INSERT INTO t1 VALUES ('other', 'anyvalue');
|
||||
INSERT INTO t2 VALUES ('old');
|
||||
INSERT INTO t2 VALUES ('other');
|
||||
UPDATE t1 SET field1 = 'other' WHERE field2 = 'somevalu';
|
||||
ERROR 23000: Upholding foreign key constraints for table 't1', entry 'other-somevalu', key 1 would lead to a duplicate entry
|
||||
DROP TABLE t2;
|
||||
DROP TABLE t1;
|
||||
create table t1 (
|
||||
c1 bigint not null,
|
||||
c2 bigint not null,
|
||||
primary key (c1),
|
||||
unique key (c2)
|
||||
) engine=innodb;
|
||||
create table t2 (
|
||||
c1 bigint not null,
|
||||
primary key (c1)
|
||||
) engine=innodb;
|
||||
alter table t1 add constraint c2_fk foreign key (c2)
|
||||
references t2(c1) on delete cascade;
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` bigint(20) NOT NULL,
|
||||
`c2` bigint(20) NOT NULL,
|
||||
PRIMARY KEY (`c1`),
|
||||
UNIQUE KEY `c2` (`c2`),
|
||||
CONSTRAINT `c2_fk` FOREIGN KEY (`c2`) REFERENCES `t2` (`c1`) ON DELETE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1
|
||||
alter table t1 drop foreign key c2_fk;
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` bigint(20) NOT NULL,
|
||||
`c2` bigint(20) NOT NULL,
|
||||
PRIMARY KEY (`c1`),
|
||||
UNIQUE KEY `c2` (`c2`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1
|
||||
drop table t1, t2;
|
||||
create table t1(a date) engine=innodb;
|
||||
create table t2(a date, key(a)) engine=innodb;
|
||||
insert into t1 values('2005-10-01');
|
||||
insert into t2 values('2005-10-01');
|
||||
select * from t1, t2
|
||||
where t2.a between t1.a - interval 2 day and t1.a + interval 2 day;
|
||||
a a
|
||||
2005-10-01 2005-10-01
|
||||
drop table t1, t2;
|
||||
create table t1 (id int not null, f_id int not null, f int not null,
|
||||
primary key(f_id, id)) engine=innodb;
|
||||
create table t2 (id int not null,s_id int not null,s varchar(200),
|
||||
primary key(id)) engine=innodb;
|
||||
INSERT INTO t1 VALUES (8, 1, 3);
|
||||
INSERT INTO t1 VALUES (1, 2, 1);
|
||||
INSERT INTO t2 VALUES (1, 0, '');
|
||||
INSERT INTO t2 VALUES (8, 1, '');
|
||||
commit;
|
||||
DELETE ml.* FROM t1 AS ml LEFT JOIN t2 AS mm ON (mm.id=ml.id)
|
||||
WHERE mm.id IS NULL;
|
||||
select ml.* from t1 as ml left join t2 as mm on (mm.id=ml.id)
|
||||
where mm.id is null lock in share mode;
|
||||
id f_id f
|
||||
drop table t1,t2;
|
||||
create table t1(a int not null, b int, primary key(a)) engine=innodb;
|
||||
insert into t1 values(1,1),(2,2),(3,1),(4,2),(5,1),(6,2),(7,3);
|
||||
commit;
|
||||
SET binlog_format='MIXED';
|
||||
set autocommit = 0;
|
||||
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
|
||||
update t1 set b = 5 where b = 1;
|
||||
SET binlog_format='MIXED';
|
||||
set autocommit = 0;
|
||||
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
|
||||
select * from t1 where a = 7 and b = 3 for update;
|
||||
a b
|
||||
7 3
|
||||
commit;
|
||||
commit;
|
||||
drop table t1;
|
||||
create table t1(a int not null, b int, primary key(a)) engine=innodb;
|
||||
insert into t1 values(1,1),(2,2),(3,1),(4,2),(5,1),(6,2);
|
||||
commit;
|
||||
set autocommit = 0;
|
||||
select * from t1 lock in share mode;
|
||||
a b
|
||||
1 1
|
||||
2 2
|
||||
3 1
|
||||
4 2
|
||||
5 1
|
||||
6 2
|
||||
update t1 set b = 5 where b = 1;
|
||||
set autocommit = 0;
|
||||
select * from t1 where a = 2 and b = 2 for update;
|
||||
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
|
||||
commit;
|
||||
commit;
|
||||
drop table t1;
|
||||
create table t1(a int not null, b int, primary key(a)) engine=innodb;
|
||||
insert into t1 values (1,2),(5,3),(4,2);
|
||||
create table t2(d int not null, e int, primary key(d)) engine=innodb;
|
||||
insert into t2 values (8,6),(12,1),(3,1);
|
||||
commit;
|
||||
set autocommit = 0;
|
||||
select * from t2 for update;
|
||||
d e
|
||||
3 1
|
||||
8 6
|
||||
12 1
|
||||
SET binlog_format='MIXED';
|
||||
set autocommit = 0;
|
||||
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
|
||||
insert into t1 select * from t2;
|
||||
update t1 set b = (select e from t2 where a = d);
|
||||
create table t3(d int not null, e int, primary key(d)) engine=innodb
|
||||
select * from t2;
|
||||
commit;
|
||||
commit;
|
||||
drop table t1, t2, t3;
|
||||
create table t1(a int not null, b int, primary key(a)) engine=innodb;
|
||||
insert into t1 values (1,2),(5,3),(4,2);
|
||||
create table t2(a int not null, b int, primary key(a)) engine=innodb;
|
||||
insert into t2 values (8,6),(12,1),(3,1);
|
||||
create table t3(d int not null, b int, primary key(d)) engine=innodb;
|
||||
insert into t3 values (8,6),(12,1),(3,1);
|
||||
create table t5(a int not null, b int, primary key(a)) engine=innodb;
|
||||
insert into t5 values (1,2),(5,3),(4,2);
|
||||
create table t6(d int not null, e int, primary key(d)) engine=innodb;
|
||||
insert into t6 values (8,6),(12,1),(3,1);
|
||||
create table t8(a int not null, b int, primary key(a)) engine=innodb;
|
||||
insert into t8 values (1,2),(5,3),(4,2);
|
||||
create table t9(d int not null, e int, primary key(d)) engine=innodb;
|
||||
insert into t9 values (8,6),(12,1),(3,1);
|
||||
commit;
|
||||
set autocommit = 0;
|
||||
select * from t2 for update;
|
||||
a b
|
||||
3 1
|
||||
8 6
|
||||
12 1
|
||||
SET binlog_format='MIXED';
|
||||
set autocommit = 0;
|
||||
SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE;
|
||||
insert into t1 select * from t2;
|
||||
SET binlog_format='MIXED';
|
||||
set autocommit = 0;
|
||||
SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE;
|
||||
update t3 set b = (select b from t2 where a = d);
|
||||
SET binlog_format='MIXED';
|
||||
set autocommit = 0;
|
||||
SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE;
|
||||
create table t4(a int not null, b int, primary key(a)) engine=innodb select * from t2;
|
||||
SET binlog_format='MIXED';
|
||||
set autocommit = 0;
|
||||
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
|
||||
insert into t5 (select * from t2 lock in share mode);
|
||||
SET binlog_format='MIXED';
|
||||
set autocommit = 0;
|
||||
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
|
||||
update t6 set e = (select b from t2 where a = d lock in share mode);
|
||||
SET binlog_format='MIXED';
|
||||
set autocommit = 0;
|
||||
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
|
||||
create table t7(a int not null, b int, primary key(a)) engine=innodb select * from t2 lock in share mode;
|
||||
SET binlog_format='MIXED';
|
||||
set autocommit = 0;
|
||||
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
|
||||
insert into t8 (select * from t2 for update);
|
||||
SET binlog_format='MIXED';
|
||||
set autocommit = 0;
|
||||
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
|
||||
update t9 set e = (select b from t2 where a = d for update);
|
||||
SET binlog_format='MIXED';
|
||||
set autocommit = 0;
|
||||
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
|
||||
create table t10(a int not null, b int, primary key(a)) engine=innodb select * from t2 for update;
|
||||
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
|
||||
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
|
||||
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
|
||||
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
|
||||
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
|
||||
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
|
||||
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
|
||||
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
|
||||
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
|
||||
commit;
|
||||
drop table t1, t2, t3, t5, t6, t8, t9;
|
||||
CREATE TABLE t1 (DB_ROW_ID int) engine=innodb;
|
||||
ERROR 42000: Incorrect column name 'DB_ROW_ID'
|
||||
CREATE TABLE t1 (
|
||||
a BIGINT(20) NOT NULL,
|
||||
PRIMARY KEY (a)
|
||||
) ENGINE=INNODB DEFAULT CHARSET=UTF8;
|
||||
CREATE TABLE t2 (
|
||||
a BIGINT(20) NOT NULL,
|
||||
b VARCHAR(128) NOT NULL,
|
||||
c TEXT NOT NULL,
|
||||
PRIMARY KEY (a,b),
|
||||
KEY idx_t2_b_c (b,c(200)),
|
||||
CONSTRAINT t_fk FOREIGN KEY (a) REFERENCES t1 (a)
|
||||
ON DELETE CASCADE
|
||||
) ENGINE=INNODB DEFAULT CHARSET=UTF8;
|
||||
INSERT INTO t1 VALUES (1);
|
||||
INSERT INTO t2 VALUES (1, 'bar', 'vbar');
|
||||
INSERT INTO t2 VALUES (1, 'BAR2', 'VBAR');
|
||||
INSERT INTO t2 VALUES (1, 'bar_bar', 'bibi');
|
||||
INSERT INTO t2 VALUES (1, 'customer_over', '1');
|
||||
SELECT * FROM t2 WHERE b = 'customer_over';
|
||||
a b c
|
||||
1 customer_over 1
|
||||
SELECT * FROM t2 WHERE BINARY b = 'customer_over';
|
||||
a b c
|
||||
1 customer_over 1
|
||||
SELECT DISTINCT p0.a FROM t2 p0 WHERE p0.b = 'customer_over';
|
||||
a
|
||||
1
|
||||
/* Bang: Empty result set, above was expected: */
|
||||
SELECT DISTINCT p0.a FROM t2 p0 WHERE BINARY p0.b = 'customer_over';
|
||||
a
|
||||
1
|
||||
SELECT p0.a FROM t2 p0 WHERE BINARY p0.b = 'customer_over';
|
||||
a
|
||||
1
|
||||
drop table t2, t1;
|
||||
CREATE TABLE t1 ( a int ) ENGINE=innodb;
|
||||
BEGIN;
|
||||
INSERT INTO t1 VALUES (1);
|
||||
OPTIMIZE TABLE t1;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 optimize note Table does not support optimize, doing recreate + analyze instead
|
||||
test.t1 optimize status OK
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (id int PRIMARY KEY, f int NOT NULL, INDEX(f)) ENGINE=InnoDB;
|
||||
CREATE TABLE t2 (id int PRIMARY KEY, f INT NOT NULL,
|
||||
CONSTRAINT t2_t1 FOREIGN KEY (id) REFERENCES t1 (id)
|
||||
ON DELETE CASCADE ON UPDATE CASCADE) ENGINE=InnoDB;
|
||||
ALTER TABLE t2 ADD FOREIGN KEY (f) REFERENCES t1 (f) ON
|
||||
DELETE CASCADE ON UPDATE CASCADE;
|
||||
SHOW CREATE TABLE t2;
|
||||
Table Create Table
|
||||
t2 CREATE TABLE `t2` (
|
||||
`id` int(11) NOT NULL,
|
||||
`f` int(11) NOT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `f` (`f`),
|
||||
CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`f`) REFERENCES `t1` (`f`) ON DELETE CASCADE ON UPDATE CASCADE,
|
||||
CONSTRAINT `t2_t1` FOREIGN KEY (`id`) REFERENCES `t1` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1
|
||||
DROP TABLE t2, t1;
|
||||
CREATE TABLE t1 (a INT, INDEX(a)) ENGINE=InnoDB;
|
||||
CREATE TABLE t2 (a INT, INDEX(a)) ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES (1);
|
||||
INSERT INTO t2 VALUES (1);
|
||||
ALTER TABLE t2 ADD FOREIGN KEY (a) REFERENCES t1 (a) ON DELETE SET NULL;
|
||||
ALTER TABLE t2 MODIFY a INT NOT NULL;
|
||||
ERROR HY000: Error on rename of '#sql-temporary' to './test/t2' (errno: 150)
|
||||
DELETE FROM t1;
|
||||
DROP TABLE t2,t1;
|
||||
CREATE TABLE t1 (a VARCHAR(5) COLLATE utf8_unicode_ci PRIMARY KEY)
|
||||
ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES (0xEFBCA4EFBCA4EFBCA4);
|
||||
DELETE FROM t1;
|
||||
INSERT INTO t1 VALUES ('DDD');
|
||||
SELECT * FROM t1;
|
||||
a
|
||||
DDD
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (id int PRIMARY KEY AUTO_INCREMENT) ENGINE=InnoDB
|
||||
AUTO_INCREMENT=42;
|
||||
INSERT INTO t1 VALUES (0),(347),(0);
|
||||
SELECT * FROM t1;
|
||||
id
|
||||
42
|
||||
347
|
||||
348
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=349 DEFAULT CHARSET=latin1
|
||||
CREATE TABLE t2 (id int PRIMARY KEY) ENGINE=InnoDB;
|
||||
INSERT INTO t2 VALUES(42),(347),(348);
|
||||
ALTER TABLE t1 ADD CONSTRAINT t1_t2 FOREIGN KEY (id) REFERENCES t2(id);
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`id`),
|
||||
CONSTRAINT `t1_t2` FOREIGN KEY (`id`) REFERENCES `t2` (`id`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=349 DEFAULT CHARSET=latin1
|
||||
DROP TABLE t1,t2;
|
||||
SET innodb_strict_mode=ON;
|
||||
CREATE TABLE t1 (
|
||||
c01 CHAR(255), c02 CHAR(255), c03 CHAR(255), c04 CHAR(255),
|
||||
c05 CHAR(255), c06 CHAR(255), c07 CHAR(255), c08 CHAR(255),
|
||||
c09 CHAR(255), c10 CHAR(255), c11 CHAR(255), c12 CHAR(255),
|
||||
c13 CHAR(255), c14 CHAR(255), c15 CHAR(255), c16 CHAR(255),
|
||||
c17 CHAR(255), c18 CHAR(255), c19 CHAR(255), c20 CHAR(255),
|
||||
c21 CHAR(255), c22 CHAR(255), c23 CHAR(255), c24 CHAR(255),
|
||||
c25 CHAR(255), c26 CHAR(255), c27 CHAR(255), c28 CHAR(255),
|
||||
c29 CHAR(255), c30 CHAR(255), c31 CHAR(255), c32 CHAR(255)
|
||||
) ENGINE = InnoDB;
|
||||
ERROR 42000: Row size too large. The maximum row size for the used table type, not counting BLOBs, is 8126. You have to change some columns to TEXT or BLOBs
|
||||
SET innodb_strict_mode=OFF;
|
||||
DROP TABLE IF EXISTS t1;
|
||||
Warnings:
|
||||
Note 1051 Unknown table 't1'
|
||||
CREATE TABLE t1(
|
||||
id BIGINT(20) NOT NULL AUTO_INCREMENT PRIMARY KEY
|
||||
) ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES(-10);
|
||||
SELECT * FROM t1;
|
||||
id
|
||||
-10
|
||||
INSERT INTO t1 VALUES(NULL);
|
||||
SELECT * FROM t1;
|
||||
id
|
||||
-10
|
||||
1
|
||||
DROP TABLE t1;
|
||||
SET binlog_format='MIXED';
|
||||
SET TX_ISOLATION='read-committed';
|
||||
SET AUTOCOMMIT=0;
|
||||
DROP TABLE IF EXISTS t1, t2;
|
||||
Warnings:
|
||||
Note 1051 Unknown table 't1'
|
||||
Note 1051 Unknown table 't2'
|
||||
CREATE TABLE t1 ( a int ) ENGINE=InnoDB;
|
||||
CREATE TABLE t2 LIKE t1;
|
||||
SELECT * FROM t2;
|
||||
a
|
||||
SET binlog_format='MIXED';
|
||||
SET TX_ISOLATION='read-committed';
|
||||
SET AUTOCOMMIT=0;
|
||||
INSERT INTO t1 VALUES (1);
|
||||
COMMIT;
|
||||
SELECT * FROM t1 WHERE a=1;
|
||||
a
|
||||
1
|
||||
SET binlog_format='MIXED';
|
||||
SET TX_ISOLATION='read-committed';
|
||||
SET AUTOCOMMIT=0;
|
||||
SELECT * FROM t2;
|
||||
a
|
||||
SET binlog_format='MIXED';
|
||||
SET TX_ISOLATION='read-committed';
|
||||
SET AUTOCOMMIT=0;
|
||||
INSERT INTO t1 VALUES (2);
|
||||
COMMIT;
|
||||
SELECT * FROM t1 WHERE a=2;
|
||||
a
|
||||
2
|
||||
SELECT * FROM t1 WHERE a=2;
|
||||
a
|
||||
2
|
||||
DROP TABLE t1;
|
||||
DROP TABLE t2;
|
||||
create table t1 (i int, j int) engine=innodb;
|
||||
insert into t1 (i, j) values (1, 1), (2, 2);
|
||||
update t1 set j = 2;
|
||||
affected rows: 1
|
||||
info: Rows matched: 2 Changed: 1 Warnings: 0
|
||||
drop table t1;
|
||||
create table t1 (id int) comment='this is a comment' engine=innodb;
|
||||
select table_comment, data_free > 0 as data_free_is_set
|
||||
from information_schema.tables
|
||||
where table_schema='test' and table_name = 't1';
|
||||
table_comment data_free_is_set
|
||||
this is a comment 1
|
||||
drop table t1;
|
||||
CREATE TABLE t1 (
|
||||
c1 INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
c2 VARCHAR(128) NOT NULL,
|
||||
PRIMARY KEY(c1)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=100;
|
||||
CREATE TABLE t2 (
|
||||
c1 INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
c2 INT(10) UNSIGNED DEFAULT NULL,
|
||||
PRIMARY KEY(c1)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=200;
|
||||
SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE table_name = 't2';
|
||||
AUTO_INCREMENT
|
||||
200
|
||||
ALTER TABLE t2 ADD CONSTRAINT t1_t2_1 FOREIGN KEY(c1) REFERENCES t1(c1);
|
||||
SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE table_name = 't2';
|
||||
AUTO_INCREMENT
|
||||
200
|
||||
DROP TABLE t2;
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (c1 int default NULL,
|
||||
c2 int default NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
||||
TRUNCATE TABLE t1;
|
||||
affected rows: 0
|
||||
INSERT INTO t1 VALUES (1, 1), (2, 2), (3, 3), (4, 4), (5, 5);
|
||||
affected rows: 5
|
||||
info: Records: 5 Duplicates: 0 Warnings: 0
|
||||
TRUNCATE TABLE t1;
|
||||
affected rows: 0
|
||||
DROP TABLE t1;
|
||||
Variable_name Value
|
||||
Handler_update 0
|
||||
Variable_name Value
|
||||
Handler_delete 0
|
||||
Variable_name Value
|
||||
Handler_update 1
|
||||
Variable_name Value
|
||||
Handler_delete 1
|
||||
@@ -887,13 +887,13 @@ EXPLAIN SELECT * FROM t1 WHERE b BETWEEN 1 AND 2 ORDER BY a;
|
||||
id 1
|
||||
select_type SIMPLE
|
||||
table t1
|
||||
type range
|
||||
type index
|
||||
possible_keys bkey
|
||||
key bkey
|
||||
key_len 5
|
||||
key PRIMARY
|
||||
key_len 4
|
||||
ref NULL
|
||||
rows 16
|
||||
Extra Using where; Using index; Using filesort
|
||||
rows 32
|
||||
Extra Using where
|
||||
SELECT * FROM t1 WHERE b BETWEEN 1 AND 2 ORDER BY a;
|
||||
a b
|
||||
1 2
|
||||
@@ -932,12 +932,12 @@ EXPLAIN SELECT * FROM t1 WHERE b BETWEEN 1 AND 2 ORDER BY b,a;
|
||||
id 1
|
||||
select_type SIMPLE
|
||||
table t1
|
||||
type range
|
||||
type index
|
||||
possible_keys bkey
|
||||
key bkey
|
||||
key_len 5
|
||||
ref NULL
|
||||
rows 16
|
||||
rows 32
|
||||
Extra Using where; Using index
|
||||
SELECT * FROM t1 WHERE b BETWEEN 1 AND 2 ORDER BY b,a;
|
||||
a b
|
||||
@@ -987,7 +987,7 @@ possible_keys bkey
|
||||
key bkey
|
||||
key_len 5
|
||||
ref const
|
||||
rows 8
|
||||
rows 16
|
||||
Extra Using where; Using index; Using filesort
|
||||
SELECT * FROM t2 WHERE b=1 ORDER BY a;
|
||||
a b c
|
||||
@@ -1016,7 +1016,7 @@ possible_keys bkey
|
||||
key bkey
|
||||
key_len 10
|
||||
ref const,const
|
||||
rows 8
|
||||
rows 16
|
||||
Extra Using where; Using index
|
||||
SELECT * FROM t2 WHERE b=1 AND c=1 ORDER BY a;
|
||||
a b c
|
||||
@@ -1045,7 +1045,7 @@ possible_keys bkey
|
||||
key bkey
|
||||
key_len 10
|
||||
ref const,const
|
||||
rows 8
|
||||
rows 16
|
||||
Extra Using where; Using index
|
||||
SELECT * FROM t2 WHERE b=1 AND c=1 ORDER BY b,c,a;
|
||||
a b c
|
||||
@@ -1074,7 +1074,7 @@ possible_keys bkey
|
||||
key bkey
|
||||
key_len 10
|
||||
ref const,const
|
||||
rows 8
|
||||
rows 16
|
||||
Extra Using where; Using index
|
||||
SELECT * FROM t2 WHERE b=1 AND c=1 ORDER BY c,a;
|
||||
a b c
|
||||
@@ -1209,7 +1209,7 @@ possible_keys b
|
||||
key b
|
||||
key_len 5
|
||||
ref const
|
||||
rows 1
|
||||
rows 2
|
||||
Extra Using where; Using index
|
||||
SELECT * FROM t1 WHERE b=2 ORDER BY a ASC;
|
||||
a b
|
||||
@@ -1224,7 +1224,7 @@ possible_keys b
|
||||
key b
|
||||
key_len 5
|
||||
ref const
|
||||
rows 1
|
||||
rows 2
|
||||
Extra Using where; Using index
|
||||
SELECT * FROM t1 WHERE b=2 ORDER BY a DESC;
|
||||
a b
|
||||
@@ -1368,7 +1368,7 @@ INSERT INTO t1 (a,b,c) VALUES (1,1,1), (2,1,1), (3,1,1), (4,1,1);
|
||||
INSERT INTO t1 (a,b,c) SELECT a+4,b,c FROM t1;
|
||||
EXPLAIN SELECT a, b, c FROM t1 WHERE b = 1 ORDER BY a DESC LIMIT 5;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 index t1_b PRIMARY 4 NULL 8 Using where
|
||||
1 SIMPLE t1 range t1_b t1_b 5 NULL 8 Using index condition
|
||||
SELECT a, b, c FROM t1 WHERE b = 1 ORDER BY a DESC LIMIT 5;
|
||||
a b c
|
||||
8 1 1
|
||||
@@ -1740,7 +1740,7 @@ SELECT 1 FROM (SELECT COUNT(DISTINCT c1)
|
||||
FROM t1 WHERE c2 IN (1, 1) AND c3 = 2 GROUP BY c2) x;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY <derived2> ALL NULL NULL NULL NULL 2
|
||||
2 DERIVED t1 index_merge c3,c2 c3,c2 5,10 NULL 1 Using intersect(c3,c2); Using where; Using filesort
|
||||
2 DERIVED t1 ref c3,c2 c3 5 const 2 Using where; Using filesort
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (c1 REAL, c2 REAL, c3 REAL, KEY (c3), KEY (c2, c3))
|
||||
ENGINE=InnoDB;
|
||||
@@ -1754,7 +1754,7 @@ SELECT 1 FROM (SELECT COUNT(DISTINCT c1)
|
||||
FROM t1 WHERE c2 IN (1, 1) AND c3 = 2 GROUP BY c2) x;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY <derived2> ALL NULL NULL NULL NULL 2
|
||||
2 DERIVED t1 index_merge c3,c2 c3,c2 9,18 NULL 1 Using intersect(c3,c2); Using where; Using filesort
|
||||
2 DERIVED t1 ref c3,c2 c3 9 const 2 Using where; Using filesort
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (c1 DECIMAL(12,2), c2 DECIMAL(12,2), c3 DECIMAL(12,2),
|
||||
KEY (c3), KEY (c2, c3))
|
||||
@@ -1769,7 +1769,7 @@ SELECT 1 FROM (SELECT COUNT(DISTINCT c1)
|
||||
FROM t1 WHERE c2 IN (1, 1) AND c3 = 2 GROUP BY c2) x;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY <derived2> ALL NULL NULL NULL NULL 2
|
||||
2 DERIVED t1 index_merge c3,c2 c3,c2 7,14 NULL 1 Using intersect(c3,c2); Using where; Using filesort
|
||||
2 DERIVED t1 ref c3,c2 c3 7 const 2 Using where; Using filesort
|
||||
DROP TABLE t1;
|
||||
End of 5.1 tests
|
||||
drop table if exists t1, t2, t3;
|
||||
@@ -1845,7 +1845,7 @@ possible_keys b
|
||||
key b
|
||||
key_len 5
|
||||
ref NULL
|
||||
rows 3
|
||||
rows 5
|
||||
Extra Using where; Using index
|
||||
EXPLAIN SELECT c FROM bar WHERE c>2;;
|
||||
id 1
|
||||
@@ -2411,4 +2411,57 @@ PACK_KEYS=0;
|
||||
CREATE INDEX a ON t1 (a);
|
||||
CREATE INDEX c on t1 (c);
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (
|
||||
pk int NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
||||
a int,
|
||||
b int,
|
||||
INDEX idx(a))
|
||||
ENGINE=INNODB;
|
||||
INSERT INTO t1(a,b) VALUES
|
||||
(11, 1100), (2, 200), (1, 100), (14, 1400), (5, 500),
|
||||
(3, 300), (17, 1700), (4, 400), (12, 1200), (8, 800),
|
||||
(6, 600), (18, 1800), (9, 900), (10, 1000), (7, 700),
|
||||
(13, 1300), (15, 1500), (19, 1900), (16, 1600), (20, 2000);
|
||||
INSERT INTO t1(a,b) SELECT a+20, b+2000 FROM t1;
|
||||
INSERT INTO t1(a,b) SELECT a+40, b+4000 FROM t1;
|
||||
INSERT INTO t1(a,b) SELECT a+80, b+8000 FROM t1;
|
||||
INSERT INTO t1(a,b) SELECT a,b FROM t1;
|
||||
INSERT INTO t1(a,b) SELECT a,b FROM t1;
|
||||
INSERT INTO t1(a,b) SELECT a,b FROM t1;
|
||||
INSERT INTO t1(a,b) SELECT a,b FROM t1;
|
||||
INSERT INTO t1(a,b) SELECT a,b FROM t1;
|
||||
INSERT INTO t1(a,b) SELECT a,b FROM t1;
|
||||
INSERT INTO t1(a,b) SELECT a,b FROM t1;
|
||||
INSERT INTO t1(a,b) SELECT a,b FROM t1;
|
||||
INSERT INTO t1 VALUES (1000000, 0, 0);
|
||||
SET SESSION sort_buffer_size = 1024*36;
|
||||
EXPLAIN
|
||||
SELECT COUNT(*) FROM
|
||||
(SELECT * FROM t1 FORCE INDEX (idx,PRIMARY)
|
||||
WHERE a BETWEEN 2 AND 7 OR pk=1000000) AS t;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 index_merge PRIMARY,idx idx,PRIMARY 5,4 NULL 1536 Using sort_union(idx,PRIMARY); Using where
|
||||
SELECT COUNT(*) FROM
|
||||
(SELECT * FROM t1 FORCE INDEX (idx,PRIMARY)
|
||||
WHERE a BETWEEN 2 AND 7 OR pk=1000000) AS t;
|
||||
COUNT(*)
|
||||
1537
|
||||
SET SESSION sort_buffer_size = DEFAULT;
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# Test for bug #11762012 - "54553: INNODB ASSERTS IN HA_INNOBASE::
|
||||
# UPDATE_ROW, TEMPORARY TABLE, TABLE LOCK".
|
||||
#
|
||||
DROP TABLE IF EXISTS t1;
|
||||
CREATE TEMPORARY TABLE t1 (c int) ENGINE = InnoDB;
|
||||
INSERT INTO t1 VALUES (1);
|
||||
LOCK TABLES t1 READ;
|
||||
# Even though temporary table was locked for READ we
|
||||
# still allow writes to it to be compatible with MyISAM.
|
||||
# This is possible since due to fact that temporary tables
|
||||
# are specific to connection and therefore locking for them
|
||||
# is irrelevant.
|
||||
UPDATE t1 SET c = 5;
|
||||
UNLOCK TABLES;
|
||||
DROP TEMPORARY TABLE t1;
|
||||
End of 5.1 tests
|
||||
|
||||
77
mysql-test/suite/innodb_plugin/r/innodb_replace.result
Normal file
77
mysql-test/suite/innodb_plugin/r/innodb_replace.result
Normal file
@@ -0,0 +1,77 @@
|
||||
#
|
||||
#Bug#11759688 52020: InnoDB can still deadlock
|
||||
#on just INSERT...ON DUPLICATE KEY
|
||||
#a.k.a. Bug#7975 deadlock without any locking, simple select and update
|
||||
#
|
||||
CREATE TABLE t1 (a INT PRIMARY KEY, b INT NOT NULL) ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES(3,1);
|
||||
BEGIN;
|
||||
SET DEBUG_SYNC='write_row_noreplace SIGNAL insert1 WAIT_FOR select1';
|
||||
INSERT INTO t1 VALUES(3,2);
|
||||
SET DEBUG_SYNC='now WAIT_FOR insert1';
|
||||
SELECT * FROM t1 LOCK IN SHARE MODE;
|
||||
a b
|
||||
3 1
|
||||
SELECT * FROM t1 FOR UPDATE;
|
||||
SET DEBUG_SYNC='now SIGNAL select1';
|
||||
ERROR 23000: Duplicate entry '3' for key 'PRIMARY'
|
||||
INSERT INTO t1 VALUES(3,3) ON DUPLICATE KEY UPDATE b=b+10;
|
||||
ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
|
||||
COMMIT;
|
||||
SET DEBUG_SYNC='write_row_replace SIGNAL insert2 WAIT_FOR select2';
|
||||
REPLACE INTO t1 VALUES(3,4);
|
||||
SET DEBUG_SYNC='now WAIT_FOR insert2';
|
||||
SELECT * FROM t1;
|
||||
a b
|
||||
3 11
|
||||
SELECT * FROM t1 LOCK IN SHARE MODE;
|
||||
SET DEBUG_SYNC='now SIGNAL select2';
|
||||
SET DEBUG_SYNC='write_row_replace SIGNAL insert3 WAIT_FOR select3';
|
||||
INSERT INTO t1 VALUES(3,5) ON DUPLICATE KEY UPDATE b=b+20;
|
||||
a b
|
||||
3 4
|
||||
SET DEBUG_SYNC='now WAIT_FOR insert3';
|
||||
SELECT b FROM t1 LOCK IN SHARE MODE;
|
||||
SET DEBUG_SYNC='now SIGNAL select3';
|
||||
b
|
||||
24
|
||||
SET DEBUG_SYNC='write_row_noreplace SIGNAL insert4 WAIT_FOR select4';
|
||||
LOAD DATA INFILE '../../std_data/loaddata5.dat' INTO TABLE t1 FIELDS TERMINATED BY '' ENCLOSED BY '' (a, b);
|
||||
SET DEBUG_SYNC='now WAIT_FOR insert4';
|
||||
SELECT b FROM t1 WHERE a=3 LOCK IN SHARE MODE;
|
||||
b
|
||||
24
|
||||
SELECT b FROM t1 WHERE a=3 FOR UPDATE;
|
||||
SET DEBUG_SYNC='now SIGNAL select4';
|
||||
b
|
||||
24
|
||||
ERROR 23000: Duplicate entry '3' for key 'PRIMARY'
|
||||
SET DEBUG_SYNC='write_row_noreplace SIGNAL insert5 WAIT_FOR select5';
|
||||
LOAD DATA INFILE '../../std_data/loaddata5.dat' IGNORE INTO TABLE t1 FIELDS TERMINATED BY '' ENCLOSED BY '' (a, b);
|
||||
SET DEBUG_SYNC='now WAIT_FOR insert5';
|
||||
SELECT * FROM t1;
|
||||
a b
|
||||
3 24
|
||||
SELECT * FROM t1 WHERE a=3 LOCK IN SHARE MODE;
|
||||
a b
|
||||
3 24
|
||||
SELECT * FROM t1 WHERE a=3 FOR UPDATE;
|
||||
SET DEBUG_SYNC='now SIGNAL select5';
|
||||
a b
|
||||
3 24
|
||||
SET DEBUG_SYNC='write_row_replace SIGNAL insert6 WAIT_FOR select6';
|
||||
LOAD DATA INFILE '../../std_data/loaddata5.dat' REPLACE INTO TABLE t1 FIELDS TERMINATED BY '' ENCLOSED BY '' (a, b);
|
||||
SET DEBUG_SYNC='now WAIT_FOR insert6';
|
||||
SELECT * FROM t1;
|
||||
a b
|
||||
1 2
|
||||
3 24
|
||||
5 6
|
||||
SELECT a,b FROM t1 LOCK IN SHARE MODE;
|
||||
SET DEBUG_SYNC='now SIGNAL select6';
|
||||
a b
|
||||
1 2
|
||||
3 4
|
||||
5 6
|
||||
SET DEBUG_SYNC='RESET';
|
||||
DROP TABLE t1;
|
||||
Reference in New Issue
Block a user