1
drop table if exists t1;
2
set @@session.max_heap_table_size=16*1024*1024;
3
create temporary table t1 (a int not null, b varchar(400), c int, primary key (a), key (c)) engine=heap comment="testing heaps" block_size=128;
4
ERROR 42000: Incorrect usage/placement of 'block_size'
5
create temporary table t1 (a int not null, b int, c varchar(400), primary key (a), key (b)) engine=heap comment="testing heaps" block_size=4;
6
ERROR 42000: Incorrect usage/placement of 'block_size'
7
create temporary table t1 (a int not null, b int, c varchar(400), d varchar(400), primary key (a), key (b)) engine=heap comment="testing heaps" block_size=24;
8
insert into t1 values (1,1,'012',NULL), (2,2,'0123456789',NULL), (3,3,'012345678901234567890123456789',NULL), (4,4,NULL,'0123456789012345678901234567890123456789012345678901234567890123456789');
13
3 3 012345678901234567890123456789 NULL
14
4 4 NULL 0123456789012345678901234567890123456789012345678901234567890123456789
15
delete from t1 where a = 3;
20
4 4 NULL 0123456789012345678901234567890123456789012345678901234567890123456789
21
insert into t1 values (5,5,NULL,'0123'), (6,6,NULL,'0123');
28
4 4 NULL 0123456789012345678901234567890123456789012345678901234567890123456789
29
update t1 set c = '012345678901234567890123456789' where a = 2;
33
2 2 012345678901234567890123456789 NULL
36
4 4 NULL 0123456789012345678901234567890123456789012345678901234567890123456789
37
update t1 set c = '0123456789' where a = 2;
44
4 4 NULL 0123456789012345678901234567890123456789012345678901234567890123456789
45
insert into t1 values (7,7,'0123',NULL), (8,8,'0123',NULL);
52
4 4 NULL 0123456789012345678901234567890123456789012345678901234567890123456789
55
alter table t1 block_size = 0;
56
alter table t1 row_format = dynamic;
57
alter table t1 block_size = 128;
64
4 4 NULL 0123456789012345678901234567890123456789012345678901234567890123456789
70
select count(*) from t1;
73
insert into t1 values (100000,100000,NULL,'0123'), (100000,100000,NULL,'0123');
74
ERROR 23000: Duplicate entry '100000' for key 'PRIMARY'
75
select count(*) from t1;
78
set @@session.max_heap_table_size=default;