1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
|
#
# Test table with a key that consists of indirect virtual fields
#
CREATE TABLE t1 (a int, b int as (a+1) virtual, c int as (b+1) virtual, index(c)) engine=myisam;
insert into t1 (a) values (1),(2),(3);
update t1 set a=5 where a=3;
delete from t1 where a=1;
select * from t1;
a b c
2 3 4
5 6 7
select * from t1 where c=7;
a b c
5 6 7
check table t1;
Table Op Msg_type Msg_text
test.t1 check status OK
select * from t1;
a b c
2 3 4
5 6 7
drop table t1;
CREATE TABLE t1 (a int, b int as (a+1) virtual, c int as (b+1) virtual, index(c)) engine=innodb;
insert into t1 (a) values (1),(2),(3);
update t1 set a=5 where a=3;
delete from t1 where a=1;
select * from t1;
a b c
2 3 4
5 6 7
select * from t1 where c=7;
a b c
5 6 7
check table t1;
Table Op Msg_type Msg_text
test.t1 check status OK
select * from t1;
a b c
2 3 4
5 6 7
drop table t1;
#
# MDEV-15114
# ASAN heap-use-after-free in mem_heap_dup or
# dfield_data_is_binary_equal
#
CREATE TABLE t1 (
pk INT,
extra tinyint,
c TEXT,
vc LONGTEXT AS (c) VIRTUAL,
i INT,
PRIMARY KEY(pk),
UNIQUE(i),
INDEX(vc(64))
) ENGINE=InnoDB;
INSERT INTO t1 (pk,extra, c, i) VALUES (1, 10, REPEAT('foo ',15000),0);
REPLACE INTO t1 (pk,extra, c,i) SELECT pk,extra+10, c,i FROM t1;
select pk, extra, left(c, 10), length(c), left(vc,10), length(vc), extra from t1;
pk extra left(c, 10) length(c) left(vc,10) length(vc) extra
1 20 foo foo fo 60000 foo foo fo 60000 20
DROP TABLE t1;
#
# Update of deleted row with binary logging enabled
#
SET BINLOG_FORMAT=row;
CREATE TABLE t1 (
pk INT,
c TEXT,
vc LONGTEXT AS (c) VIRTUAL,
i INT,
PRIMARY KEY(pk),
UNIQUE(i),
INDEX(vc(64))
) ENGINE=InnoDB;
INSERT INTO t1 (pk,c,i) VALUES (1,REPEAT('foo ',15000),10);
INSERT INTO t1 (pk,c,i) VALUES (2,REPEAT('bar ',15000),11);
connect c1,localhost,root,,;
connection c1;
begin;
DELETE from t1 WHERE pk=1;
connection default;
update t1 set pk=1 where pk=2;
connection c1;
commit;
connection default;
select pk, left(c, 10), length(c), i from t1;
pk left(c, 10) length(c) i
1 bar bar ba 60000 11
drop table t1;
disconnect c1;
CREATE TABLE t1 (b BLOB, vb TEXT AS (b) PERSISTENT, KEY(vb(64))) ENGINE=InnoDB;
INSERT INTO t1 (b) VALUES ('foo');
connect con1,localhost,root,,test;
CREATE TABLE t2 LIKE t1;
connection default;
DELETE FROM t1;
connection con1;
disconnect con1;
connection default;
DROP TABLE t1, t2;
|