summaryrefslogtreecommitdiffstats
path: root/mysql-test/suite/innodb/t/innodb-virtual-columns2.test
blob: 13ecffcc896c193f55ebd9d08d22b43ba2113226 (plain)
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
--source include/have_innodb.inc

#
# MDEV-11724: InnoDB: Failing assertion: len <= col->len || ((col->mtype) == 5 || (col->mtype) == 16 || (col->mtype) == 14) || (((col->mtype) == 15 || (col->mtype) == 16) && len == 2 * 2 * sizeof(double)) || (col->len == 0 && col->mtype == 1)
#

CREATE TABLE t1 ( 
 y YEAR NULL,
 i SMALLINT NULL,
 c VARCHAR(8) NOT NULL DEFAULT '',
 vi SMALLINT AS (i) VIRTUAL,
 INDEX(y)
) ENGINE=InnoDB;

SHOW CREATE TABLE t1;
SELECT * FROM t1 WHERE y BETWEEN 2012 AND 2016 FOR UPDATE;
INSERT INTO t1 (i) VALUES (1),(2);
SELECT * FROM t1 WHERE y BETWEEN 2012 AND 2016 FOR UPDATE;
DROP TABLE t1;

#
# MDEV-11725: InnoDB: Failing assertion: !rec || !cmp_dtuple_rec(tuple, rec, *offsets)
#

CREATE TABLE t1 ( 
 y YEAR NULL,
 i SMALLINT NULL,
 vi SMALLINT AS (i) VIRTUAL,
 INDEX(y)
) ENGINE=InnoDB;
 
SHOW CREATE TABLE t1;
SELECT * FROM t1 WHERE y BETWEEN 2012 AND 2016 FOR UPDATE;
INSERT INTO t1 (i) VALUES (1),(2);
SELECT * FROM t1 WHERE y BETWEEN 2012 AND 2016 FOR UPDATE;
DROP TABLE t1;

#
# MDEV-11726: Server crashes in mach_read_from_n_little_endian
#

CREATE TABLE t1 ( 
 y YEAR NULL,
 i SMALLINT NULL,
 b BLOB NULL,
 vi SMALLINT AS (i) VIRTUAL,
 INDEX(y)
) ENGINE=InnoDB;
 
SHOW CREATE TABLE t1;
SELECT * FROM t1 WHERE y BETWEEN 2012 AND 2016 FOR UPDATE;
INSERT INTO t1 (i) VALUES (1),(2);
SELECT * FROM t1 WHERE y BETWEEN 2012 AND 2016 FOR UPDATE;
DROP TABLE t1;

--echo #
--echo # MDEV-23632 ALTER TABLE...ADD KEY creates corrupted index on virtual column
--echo #

CREATE TABLE t1(a INT PRIMARY KEY, b INT, g INT GENERATED ALWAYS AS(b)VIRTUAL) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1,1,default);
ALTER TABLE t1 ADD COLUMN c INT;
ALTER TABLE t1 ADD KEY(g);
CHECK TABLE t1;
SELECT g FROM t1 FORCE INDEX (g);
DROP TABLE t1;

CREATE TABLE t1(a INT, b INT, g INT GENERATED ALWAYS AS(b)VIRTUAL) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1,1,default);
ALTER TABLE t1 ADD COLUMN c INT PRIMARY KEY; # Triggers `new_clustered`
ALTER TABLE t1 ADD KEY(g);
CHECK TABLE t1;
SELECT g FROM t1 FORCE INDEX (g);
DROP TABLE t1;