mirror of
https://github.com/MariaDB/server.git
synced 2025-08-08 11:22:35 +03:00
357 lines
13 KiB
Plaintext
357 lines
13 KiB
Plaintext
ALTER DATABASE test CHARACTER SET latin1 COLLATE latin1_swedish_ci;
|
|
SET default_storage_engine=InnoDB;
|
|
### Test 1 ###
|
|
create table worklog5743(a TEXT not null, primary key (a(768))) ROW_FORMAT=DYNAMIC;
|
|
show warnings;
|
|
Level Code Message
|
|
insert into worklog5743 values(repeat("a", 20000));
|
|
update worklog5743 set a = (repeat("b", 16000));
|
|
SET sql_mode= '';
|
|
create index idx on worklog5743(a(900));
|
|
show warnings;
|
|
Level Code Message
|
|
SET sql_mode= default;
|
|
begin;
|
|
update worklog5743 set a = (repeat("x", 17000));
|
|
select @@session.transaction_isolation;
|
|
@@session.transaction_isolation
|
|
REPEATABLE-READ
|
|
connect con1,localhost,root,,;
|
|
select a = repeat("x", 17000) from worklog5743;
|
|
a = repeat("x", 17000)
|
|
0
|
|
select a = repeat("b", 16000) from worklog5743;
|
|
a = repeat("b", 16000)
|
|
1
|
|
connect con2,localhost,root,,;
|
|
SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
|
|
select @@session.transaction_isolation;
|
|
@@session.transaction_isolation
|
|
READ-UNCOMMITTED
|
|
select a = repeat("x", 17000) from worklog5743;
|
|
a = repeat("x", 17000)
|
|
1
|
|
connection default;
|
|
rollback;
|
|
drop table worklog5743;
|
|
### Test 2 ###
|
|
create table worklog5743(a1 int, a2 TEXT not null) ROW_FORMAT=DYNAMIC;
|
|
show warnings;
|
|
Level Code Message
|
|
create index idx on worklog5743(a1, a2(750));
|
|
show warnings;
|
|
Level Code Message
|
|
insert into worklog5743 values(9, repeat("a", 10000));
|
|
begin;
|
|
update worklog5743 set a1 = 1111;
|
|
connection con1;
|
|
select @@session.transaction_isolation;
|
|
@@session.transaction_isolation
|
|
REPEATABLE-READ
|
|
explain select a1, a2 = repeat("a", 10000) from worklog5743 where a1 = 9;
|
|
id select_type table type possible_keys key key_len ref rows Extra
|
|
1 SIMPLE worklog5743 ref idx idx 5 const 1
|
|
select a1, a2 = repeat("a", 10000) from worklog5743 where a1 = 9;
|
|
a1 a2 = repeat("a", 10000)
|
|
9 1
|
|
connection con2;
|
|
SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
|
|
select @@session.transaction_isolation;
|
|
@@session.transaction_isolation
|
|
READ-UNCOMMITTED
|
|
select a1, a2 = repeat("a", 10000) from worklog5743 where a1 = 9;
|
|
a1 a2 = repeat("a", 10000)
|
|
connection default;
|
|
rollback;
|
|
drop table worklog5743;
|
|
### Test 3 ###
|
|
create table worklog5743(a1 int, a2 TEXT not null) ROW_FORMAT=DYNAMIC;
|
|
create index idx on worklog5743(a1, a2(50));
|
|
insert into worklog5743 values(9, repeat("a", 10000));
|
|
begin;
|
|
update worklog5743 set a1 = 2222;
|
|
connection con1;
|
|
select @@session.transaction_isolation;
|
|
@@session.transaction_isolation
|
|
REPEATABLE-READ
|
|
explain select a1, a2 = repeat("a", 10000) from worklog5743 where a1 = 9;
|
|
id select_type table type possible_keys key key_len ref rows Extra
|
|
1 SIMPLE worklog5743 ref idx idx 5 const 1
|
|
select a1, a2 = repeat("a", 10000) from worklog5743 where a1 = 9;
|
|
a1 a2 = repeat("a", 10000)
|
|
9 1
|
|
connection con2;
|
|
SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
|
|
select @@session.transaction_isolation;
|
|
@@session.transaction_isolation
|
|
READ-UNCOMMITTED
|
|
select a1, a2 = repeat("a", 10000) from worklog5743 where a1 = 9;
|
|
a1 a2 = repeat("a", 10000)
|
|
connection default;
|
|
rollback;
|
|
drop table worklog5743;
|
|
### Test 4 ###
|
|
create table worklog5743_1(a1 int, a2 TEXT not null) KEY_BLOCK_SIZE=1;
|
|
create table worklog5743_2(a1 int, a2 TEXT not null) KEY_BLOCK_SIZE=2;
|
|
create table worklog5743_4(a1 int, a2 TEXT not null) KEY_BLOCK_SIZE=4;
|
|
create index idx1 on worklog5743_1(a2(4000));
|
|
ERROR 42000: Row size too large. The maximum row size for the used table type, not counting BLOBs, is 1982. This includes storage overhead, check the manual. You have to change some columns to TEXT or BLOBs
|
|
show warnings;
|
|
Level Code Message
|
|
Note 1071 Specified key was too long; max key length is 1173 bytes
|
|
Error 1118 Row size too large. The maximum row size for the used table type, not counting BLOBs, is 1982. This includes storage overhead, check the manual. You have to change some columns to TEXT or BLOBs
|
|
create index idx3 on worklog5743_1(a2(436));
|
|
ERROR 42000: Row size too large. The maximum row size for the used table type, not counting BLOBs, is 1982. This includes storage overhead, check the manual. You have to change some columns to TEXT or BLOBs
|
|
show warnings;
|
|
Level Code Message
|
|
Error 1118 Row size too large. The maximum row size for the used table type, not counting BLOBs, is 1982. This includes storage overhead, check the manual. You have to change some columns to TEXT or BLOBs
|
|
create index idx4 on worklog5743_1(a2(290));
|
|
show warnings;
|
|
Level Code Message
|
|
create index idx5 on worklog5743_1(a1, a2(430));
|
|
ERROR 42000: Row size too large. The maximum row size for the used table type, not counting BLOBs, is 1982. This includes storage overhead, check the manual. You have to change some columns to TEXT or BLOBs
|
|
show warnings;
|
|
Level Code Message
|
|
Error 1118 Row size too large. The maximum row size for the used table type, not counting BLOBs, is 1982. This includes storage overhead, check the manual. You have to change some columns to TEXT or BLOBs
|
|
create index idx6 on worklog5743_1(a1, a2(283));
|
|
show warnings;
|
|
Level Code Message
|
|
SET sql_mode= '';
|
|
set innodb_strict_mode=off;
|
|
create index idx1 on worklog5743_2(a2(4000));
|
|
Warnings:
|
|
Note 1071 Specified key was too long; max key length is 1173 bytes
|
|
Warning 139 Row size too large (> 1982). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline.
|
|
set innodb_strict_mode=on;
|
|
show warnings;
|
|
Level Code Message
|
|
Note 1071 Specified key was too long; max key length is 1173 bytes
|
|
Warning 139 Row size too large (> 1982). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline.
|
|
show create table worklog5743_2;
|
|
Table Create Table
|
|
worklog5743_2 CREATE TABLE `worklog5743_2` (
|
|
`a1` int(11) DEFAULT NULL,
|
|
`a2` text NOT NULL,
|
|
KEY `idx1` (`a2`(1173))
|
|
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci KEY_BLOCK_SIZE=2
|
|
drop index idx1 on worklog5743_2;
|
|
create index idx3 on worklog5743_2(a2(769));
|
|
show warnings;
|
|
Level Code Message
|
|
create index idx4 on worklog5743_2(a2(768));
|
|
show warnings;
|
|
Level Code Message
|
|
create index idx6 on worklog5743_2(a1, a2(768));
|
|
show warnings;
|
|
Level Code Message
|
|
set innodb_strict_mode=off;
|
|
create index idx1 on worklog5743_4(a2(4000));
|
|
Warnings:
|
|
Note 1071 Specified key was too long; max key length is 1173 bytes
|
|
set innodb_strict_mode=on;
|
|
show warnings;
|
|
Level Code Message
|
|
Note 1071 Specified key was too long; max key length is 1173 bytes
|
|
show create table worklog5743_4;
|
|
Table Create Table
|
|
worklog5743_4 CREATE TABLE `worklog5743_4` (
|
|
`a1` int(11) DEFAULT NULL,
|
|
`a2` text NOT NULL,
|
|
KEY `idx1` (`a2`(1173))
|
|
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci KEY_BLOCK_SIZE=4
|
|
create index idx3 on worklog5743_4(a2(769));
|
|
show warnings;
|
|
Level Code Message
|
|
create index idx4 on worklog5743_4(a2(768));
|
|
show warnings;
|
|
Level Code Message
|
|
create index idx6 on worklog5743_4(a1, a2(764));
|
|
show warnings;
|
|
Level Code Message
|
|
SET sql_mode= default;
|
|
insert into worklog5743_1 values(9, repeat("a", 10000));
|
|
insert into worklog5743_2 values(9, repeat("a", 10000));
|
|
insert into worklog5743_4 values(9, repeat("a", 10000));
|
|
select a1, left(a2, 20) from worklog5743_1;
|
|
a1 left(a2, 20)
|
|
9 aaaaaaaaaaaaaaaaaaaa
|
|
select a1, left(a2, 20) from worklog5743_2;
|
|
a1 left(a2, 20)
|
|
9 aaaaaaaaaaaaaaaaaaaa
|
|
select a1, left(a2, 20) from worklog5743_4;
|
|
a1 left(a2, 20)
|
|
9 aaaaaaaaaaaaaaaaaaaa
|
|
begin;
|
|
update worklog5743_1 set a1 = 1000;
|
|
update worklog5743_2 set a1 = 1000;
|
|
update worklog5743_4 set a1 = 1000;
|
|
select a1, left(a2, 20) from worklog5743_1;
|
|
a1 left(a2, 20)
|
|
1000 aaaaaaaaaaaaaaaaaaaa
|
|
select a1, left(a2, 20) from worklog5743_2;
|
|
a1 left(a2, 20)
|
|
1000 aaaaaaaaaaaaaaaaaaaa
|
|
select a1, left(a2, 20) from worklog5743_4;
|
|
a1 left(a2, 20)
|
|
1000 aaaaaaaaaaaaaaaaaaaa
|
|
connection con1;
|
|
select @@session.transaction_isolation;
|
|
@@session.transaction_isolation
|
|
REPEATABLE-READ
|
|
explain select a1, left(a2, 20) from worklog5743_1 where a1 = 9;
|
|
id select_type table type possible_keys key key_len ref rows Extra
|
|
1 SIMPLE worklog5743_1 ref idx6 idx6 5 const 1
|
|
explain select a1, left(a2, 20) from worklog5743_2 where a1 = 9;
|
|
id select_type table type possible_keys key key_len ref rows Extra
|
|
1 SIMPLE worklog5743_2 ref idx6 idx6 5 const 1
|
|
explain select a1, left(a2, 20) from worklog5743_4 where a1 = 9;
|
|
id select_type table type possible_keys key key_len ref rows Extra
|
|
1 SIMPLE worklog5743_4 ref idx6 idx6 5 const 1
|
|
select a1, left(a2, 20) from worklog5743_1 where a1 = 9;
|
|
a1 left(a2, 20)
|
|
9 aaaaaaaaaaaaaaaaaaaa
|
|
select a1, left(a2, 20) from worklog5743_2 where a1 = 9;
|
|
a1 left(a2, 20)
|
|
9 aaaaaaaaaaaaaaaaaaaa
|
|
select a1, left(a2, 20) from worklog5743_4 where a1 = 9;
|
|
a1 left(a2, 20)
|
|
9 aaaaaaaaaaaaaaaaaaaa
|
|
connection con2;
|
|
SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
|
|
select @@session.transaction_isolation;
|
|
@@session.transaction_isolation
|
|
READ-UNCOMMITTED
|
|
select a1, left(a2, 20) from worklog5743_1 where a1 = 9;
|
|
a1 left(a2, 20)
|
|
select a1, left(a2, 20) from worklog5743_2 where a1 = 9;
|
|
a1 left(a2, 20)
|
|
select a1, left(a2, 20) from worklog5743_4 where a1 = 9;
|
|
a1 left(a2, 20)
|
|
connection default;
|
|
rollback;
|
|
drop table worklog5743_1;
|
|
drop table worklog5743_2;
|
|
drop table worklog5743_4;
|
|
### Test 5 ###
|
|
create table worklog5743(a1 int, a2 varchar(20000)) ROW_FORMAT=DYNAMIC;
|
|
create index idx1 on worklog5743(a2);
|
|
ERROR 42000: Specified key was too long; max key length is 1173 bytes
|
|
show warnings;
|
|
Level Code Message
|
|
Note 1071 Specified key was too long; max key length is 3072 bytes
|
|
Error 1071 Specified key was too long; max key length is 1173 bytes
|
|
drop table worklog5743;
|
|
create table worklog5743(a1 int, a2 varchar(3072)) ROW_FORMAT=DYNAMIC;
|
|
create index idx1 on worklog5743(a2);
|
|
ERROR 42000: Specified key was too long; max key length is 1173 bytes
|
|
show warnings;
|
|
Level Code Message
|
|
Error 1071 Specified key was too long; max key length is 1173 bytes
|
|
drop table worklog5743;
|
|
create table worklog5743(a1 int, a2 varchar(769)) ROW_FORMAT=DYNAMIC;
|
|
create index idx1 on worklog5743(a2);
|
|
show warnings;
|
|
Level Code Message
|
|
drop table worklog5743;
|
|
create table worklog5743(a1 int, a2 varchar(768)) ROW_FORMAT=DYNAMIC;
|
|
create index idx1 on worklog5743(a2);
|
|
show warnings;
|
|
Level Code Message
|
|
insert into worklog5743 values(9, repeat("a", 768));
|
|
update worklog5743 set a1 = 3333;
|
|
drop table worklog5743;
|
|
create table worklog5743(a1 int, a2 varchar(765)) ROW_FORMAT=DYNAMIC;
|
|
create index idx1 on worklog5743(a1, a2);
|
|
show warnings;
|
|
Level Code Message
|
|
drop table worklog5743;
|
|
create table worklog5743(a1 int, a2 varchar(764)) ROW_FORMAT=DYNAMIC;
|
|
create index idx1 on worklog5743(a1, a2);
|
|
show warnings;
|
|
Level Code Message
|
|
insert into worklog5743 values(9, repeat("a", 764));
|
|
begin;
|
|
update worklog5743 set a1 = 4444;
|
|
connection con1;
|
|
select @@session.transaction_isolation;
|
|
@@session.transaction_isolation
|
|
REPEATABLE-READ
|
|
explain select a1 from worklog5743 where a1 = 9;
|
|
id select_type table type possible_keys key key_len ref rows Extra
|
|
1 SIMPLE worklog5743 ref idx1 idx1 5 const 1 Using index
|
|
select a1 from worklog5743 where a1 = 9;
|
|
a1
|
|
9
|
|
connection con2;
|
|
SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
|
|
select @@session.transaction_isolation;
|
|
@@session.transaction_isolation
|
|
READ-UNCOMMITTED
|
|
select a1 from worklog5743 where a1 = 9;
|
|
a1
|
|
connection default;
|
|
rollback;
|
|
drop table worklog5743;
|
|
### Test 6 ###
|
|
create table worklog5743(a TEXT not null, primary key (a(1000)));
|
|
drop table worklog5743;
|
|
create table worklog5743(a TEXT) ROW_FORMAT=COMPACT;
|
|
create index idx on worklog5743(a(768));
|
|
ERROR HY000: Index column size too large. The maximum column size is 767 bytes
|
|
create index idx on worklog5743(a(767));
|
|
insert into worklog5743 values(repeat("a", 20000));
|
|
begin;
|
|
insert into worklog5743 values(repeat("b", 20000));
|
|
update worklog5743 set a = (repeat("x", 25000));
|
|
select @@session.transaction_isolation;
|
|
@@session.transaction_isolation
|
|
REPEATABLE-READ
|
|
connection con1;
|
|
select a = repeat("a", 20000) from worklog5743;
|
|
a = repeat("a", 20000)
|
|
1
|
|
disconnect con1;
|
|
connection con2;
|
|
SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
|
|
select @@session.transaction_isolation;
|
|
@@session.transaction_isolation
|
|
READ-UNCOMMITTED
|
|
select a = repeat("x", 25000) from worklog5743;
|
|
a = repeat("x", 25000)
|
|
1
|
|
1
|
|
disconnect con2;
|
|
connection default;
|
|
rollback;
|
|
drop table worklog5743;
|
|
### Test 7 ###
|
|
create table worklog5743(a TEXT not null) ROW_FORMAT=DYNAMIC;
|
|
SET sql_mode= '';
|
|
create index idx1 on worklog5743(a(769));
|
|
show warnings;
|
|
Level Code Message
|
|
SET sql_mode= default;
|
|
create index idx2 on worklog5743(a(768));
|
|
show warnings;
|
|
Level Code Message
|
|
show create table worklog5743;
|
|
Table Create Table
|
|
worklog5743 CREATE TABLE `worklog5743` (
|
|
`a` text NOT NULL,
|
|
KEY `idx1` (`a`(769)),
|
|
KEY `idx2` (`a`(768))
|
|
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=DYNAMIC
|
|
insert into worklog5743 values(repeat("a", 768));
|
|
drop table worklog5743;
|
|
create table worklog5743(a TEXT not null) ROW_FORMAT=REDUNDANT;
|
|
create index idx on worklog5743(a(768));
|
|
ERROR HY000: Index column size too large. The maximum column size is 767 bytes
|
|
create index idx2 on worklog5743(a(767));
|
|
drop table worklog5743;
|
|
create table worklog5743(a TEXT not null) ROW_FORMAT=COMPACT;
|
|
create index idx on worklog5743(a(768));
|
|
ERROR HY000: Index column size too large. The maximum column size is 767 bytes
|
|
create index idx2 on worklog5743(a(767));
|
|
drop table worklog5743;
|
|
ALTER DATABASE test CHARACTER SET utf8mb4 COLLATE utf8mb4_uca1400_ai_ci;
|