File: gcol_update.test

package info (click to toggle)
mysql-8.0 8.0.43-3
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,273,924 kB
  • sloc: cpp: 4,684,605; ansic: 412,450; pascal: 108,398; java: 83,641; perl: 30,221; cs: 27,067; sql: 26,594; sh: 24,181; python: 21,816; yacc: 17,169; php: 11,522; xml: 7,388; javascript: 7,076; makefile: 2,194; lex: 1,075; awk: 670; asm: 520; objc: 183; ruby: 97; lisp: 86
file content (80 lines) | stat: -rw-r--r-- 2,275 bytes parent folder | download
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
--source include/have_debug.inc

set global innodb_purge_stop_now = 1;

# Index on virtual column

create table t1(f1 int not null, f2 blob not null, f3 blob not null,
		vchar char(2) as (substr(f3,2,2)) virtual,
		primary key(f1, f3(5)), index(vchar))engine=innodb;

insert into t1(f1,f2,f3) values(1, repeat('a',8000), repeat('b', 9000));

update t1 set f1=5 where f1=1;
delete from t1 where f1=5;

set global innodb_purge_run_now=1;
set global innodb_fast_shutdown=0;
--source include/restart_mysqld.inc
set global innodb_purge_stop_now = 1;
drop table t1;

# Index on virtual column and blob

create table t1(f1 int not null, f2 blob not null, f3 blob not null,
		vchar char(2) as (substr(f3,2,2)) virtual,
		primary key(f1, f3(5)), index(vchar, f3(2)))engine=innodb;

insert into t1(f1,f2,f3) values(1, repeat('a',8000), repeat('b', 9000));

update t1 set f1=5 where f1=1;
delete from t1 where f1=5;

set global innodb_purge_run_now=1;
set global innodb_fast_shutdown=0;
--source include/restart_mysqld.inc
set global innodb_purge_stop_now = 1;
drop table t1;

# Index on virtual column of blob type

create table t1(f1 int not null, f2 blob not null, f3 blob not null,
		vchar blob as (f3) virtual,
		primary key(f1, f3(5)), index(vchar(3)))engine=innodb;

insert into t1(f1,f2,f3) values(1, repeat('a',8000), repeat('b', 9000));

update t1 set f1=5 where f1=1;
delete from t1 where f1=5;

set global innodb_purge_run_now=1;
set global innodb_fast_shutdown=0;
--source include/restart_mysqld.inc
drop table t1;

--echo #
--echo # Bug #26838771: GCOL: INCORRECT BEHAVIOR WITH UPDATE ON FLY
--echo #

CREATE TABLE t1(c1 INT);
CREATE TABLE t2(c1 INT, c2 JSON, c3 varchar(15) GENERATED ALWAYS AS
                (concat(c2,_utf8mb4'x')) VIRTUAL);
CREATE TABLE t3(c1 JSON, c2 INT GENERATED ALWAYS AS ((c1 + 1)) VIRTUAL);

INSERT INTO t2(c1,c2) VALUES(1, '{"tr": "x"}'), (2, '{"tr": "x"}');
INSERT INTO t3(c1) VALUES(CAST(7 AS JSON));


--error ER_NON_DEFAULT_VALUE_FOR_GENERATED_COLUMN
UPDATE t3 SET c2 = 0;

--error ER_NON_DEFAULT_VALUE_FOR_GENERATED_COLUMN
UPDATE t3 JOIN t2 ON (t3.c1 = t2.c1) SET t3.c2 = 0;

--error ER_NON_DEFAULT_VALUE_FOR_GENERATED_COLUMN
UPDATE t1 RIGHT JOIN
       t2 ON (t1.c1 = t2.c1),
       t3
SET t2.c2 = 'tr', t3.c2 = 0;

DROP TABLE t1,t2,t3;