Debian Codegraph @

mysql-test/suite/vcol/t/index.test

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