Debian Codegraph @

mysql-test/suite/gcol/t/gcol_update.test

raw
1 --source include/have_debug.inc
2
3 set global innodb_purge_stop_now = 1;
4
5 # Index on virtual column
6
7 create table t1(f1 int not null, f2 blob not null, f3 blob not null,
8 vchar char(2) as (substr(f3,2,2)) virtual,
9 primary key(f1, f3(5)), index(vchar))engine=innodb;
10
11 insert into t1(f1,f2,f3) values(1, repeat('a',8000), repeat('b', 9000));
12
13 update t1 set f1=5 where f1=1;
14 delete from t1 where f1=5;
15
16 set global innodb_purge_run_now=1;
17 set global innodb_fast_shutdown=0;
18 --source include/restart_mysqld.inc
19 set global innodb_purge_stop_now = 1;
20 drop table t1;
21
22 # Index on virtual column and blob
23
24 create table t1(f1 int not null, f2 blob not null, f3 blob not null,
25 vchar char(2) as (substr(f3,2,2)) virtual,
26 primary key(f1, f3(5)), index(vchar, f3(2)))engine=innodb;
27
28 insert into t1(f1,f2,f3) values(1, repeat('a',8000), repeat('b', 9000));
29
30 update t1 set f1=5 where f1=1;
31 delete from t1 where f1=5;
32
33 set global innodb_purge_run_now=1;
34 set global innodb_fast_shutdown=0;
35 --source include/restart_mysqld.inc
36 set global innodb_purge_stop_now = 1;
37 drop table t1;
38
39 # Index on virtual column of blob type
40
41 create table t1(f1 int not null, f2 blob not null, f3 blob not null,
42 vchar blob as (f3) virtual,
43 primary key(f1, f3(5)), index(vchar(3)))engine=innodb;
44
45 insert into t1(f1,f2,f3) values(1, repeat('a',8000), repeat('b', 9000));
46
47 update t1 set f1=5 where f1=1;
48 delete from t1 where f1=5;
49
50 set global innodb_purge_run_now=1;
51 set global innodb_fast_shutdown=0;
52 --source include/restart_mysqld.inc
53 drop table t1;
54
55 --echo #
56 --echo # Bug #26838771: GCOL: INCORRECT BEHAVIOR WITH UPDATE ON FLY
57 --echo #
58
59 CREATE TABLE t1(c1 INT);
60 CREATE TABLE t2(c1 INT, c2 JSON, c3 varchar(15) GENERATED ALWAYS AS
61 (concat(c2,_utf8mb4'x')) VIRTUAL);
62 CREATE TABLE t3(c1 JSON, c2 INT GENERATED ALWAYS AS ((c1 + 1)) VIRTUAL);
63
64 INSERT INTO t2(c1,c2) VALUES(1, '{"tr": "x"}'), (2, '{"tr": "x"}');
65 INSERT INTO t3(c1) VALUES(CAST(7 AS JSON));
66
67
68 --error ER_NON_DEFAULT_VALUE_FOR_GENERATED_COLUMN
69 UPDATE t3 SET c2 = 0;
70
71 --error ER_NON_DEFAULT_VALUE_FOR_GENERATED_COLUMN
72 UPDATE t3 JOIN t2 ON (t3.c1 = t2.c1) SET t3.c2 = 0;
73
74 --error ER_NON_DEFAULT_VALUE_FOR_GENERATED_COLUMN
75 UPDATE t1 RIGHT JOIN
76 t2 ON (t1.c1 = t2.c1),
77 t3
78 SET t2.c2 = 'tr', t3.c2 = 0;
79
80 DROP TABLE t1,t2,t3;