Debian Codegraph @

mysql-test/suite/storage_engine/vcol.test

raw
1 #
2 # Virtual columns
3 #
4
5 --source have_engine.inc
6
7 --disable_warnings
8 DROP TABLE IF EXISTS t1;
9 --enable_warnings
10
11 let $create_definition = a $int_col, b $int_col GENERATED ALWAYS AS (a+1);
12 --source create_table.inc
13 if ($mysql_errname)
14 {
15 --let $my_last_stmt = $create_statement
16 --let $functionality = Virtual columns
17 --source unexpected_result.inc
18 }
19 if (!$mysql_errname)
20 {
21 --replace_column 3 # 5 #
22 SHOW COLUMNS IN t1;
23
24 INSERT INTO t1 (a) VALUES (1),(2);
25 INSERT INTO t1 (a,b) VALUES (3,3),(4,4);
26 --sorted_result
27 SELECT a,b FROM t1;
28
29 DROP TABLE t1;
30
31 let $create_definition = a $int_col, b $int_col GENERATED ALWAYS AS (a+1) PERSISTENT;
32 --source create_table.inc
33
34 --replace_column 3 # 5 #
35 SHOW COLUMNS IN t1;
36
37 INSERT INTO t1 (a) VALUES (1),(2);
38 INSERT INTO t1 (a,b) VALUES (3,3),(4,4);
39 --sorted_result
40 SELECT a,b FROM t1;
41
42 DROP TABLE t1;
43
44 let $create_definition = a $int_col, b $int_col GENERATED ALWAYS AS (a+1) VIRTUAL;
45 --source create_table.inc
46
47 --replace_column 3 # 5 #
48 SHOW COLUMNS IN t1;
49
50 INSERT INTO t1 (a) VALUES (1),(2);
51 INSERT INTO t1 (a,b) VALUES (3,3),(4,4);
52 --sorted_result
53 SELECT a,b FROM t1;
54
55 DROP TABLE t1;
56
57 let $create_definition = a $int_col, b $int_col AS (a+1) PERSISTENT;
58 --source create_table.inc
59
60 --replace_column 3 # 5 #
61 SHOW COLUMNS IN t1;
62
63 INSERT INTO t1 (a) VALUES (1),(2);
64 INSERT INTO t1 (a,b) VALUES (3,3),(4,4);
65 --sorted_result
66 SELECT a,b FROM t1;
67
68 DROP TABLE t1;
69 }
70
71 --source cleanup_engine.inc
72