summaryrefslogtreecommitdiff
path: root/mysql-test/include/column_compression_syntax_varchar.inc
blob: 41ace4fe5f66cfbffad57fd340b2762d44c3a632 (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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
--echo #
--echo # The following statements run without warnings.
--echo # The `compressed opt_binary` grammar sequence is covered.
--echo #

--eval CREATE TABLE t1 (a $type COMPRESSED)
SHOW CREATE TABLE t1;
DROP TABLE t1;
--eval CREATE TABLE t1 (a $type COMPRESSED BINARY)
SHOW CREATE TABLE t1;
DROP TABLE t1;
--eval CREATE TABLE t1 (a $type COMPRESSED BINARY ASCII)
SHOW CREATE TABLE t1;
DROP TABLE t1;
--eval CREATE TABLE t1 (a $type COMPRESSED BYTE)
SHOW CREATE TABLE t1;
DROP TABLE t1;
--eval CREATE TABLE t1 (a $type COMPRESSED ASCII)
SHOW CREATE TABLE t1;
DROP TABLE t1;
--eval CREATE TABLE t1 (a $type COMPRESSED UNICODE)
SHOW CREATE TABLE t1;
DROP TABLE t1;
--eval CREATE TABLE t1 (a $type COMPRESSED CHARACTER SET utf8)
SHOW CREATE TABLE t1;
DROP TABLE t1;


--echo #
--echo # The following statements run without warnings.
--echo # They have extra column attributes (or GENERATED) after COMPRESSED.
--echo #

--eval CREATE TABLE t1 (a $type COMPRESSED BYTE DEFAULT '')
SHOW CREATE TABLE t1;
DROP TABLE t1;
--eval CREATE TABLE t1 (a $type COMPRESSED BINARY DEFAULT '')
SHOW CREATE TABLE t1;
DROP TABLE t1;
--eval CREATE TABLE t1 (a $type COMPRESSED ASCII DEFAULT '')
SHOW CREATE TABLE t1;
DROP TABLE t1;
--eval CREATE TABLE t1 (a $type COMPRESSED CHARACTER SET utf8 DEFAULT '')
SHOW CREATE TABLE t1;
DROP TABLE t1;

--eval CREATE TABLE t1 (a $type COMPRESSED CHARACTER SET utf8 GENERATED ALWAYS AS (REPEAT('a',100)))
SHOW CREATE TABLE t1;
DROP TABLE t1;


--echo #
--echo # The following statements return deprecated syntax warnings
--echo #

--enable_prepare_warnings

--eval CREATE TABLE t1 (a $type BINARY COMPRESSED)
SHOW CREATE TABLE t1;
DROP TABLE t1;
--eval CREATE TABLE t1 (a $type ASCII COMPRESSED)
SHOW CREATE TABLE t1;
DROP TABLE t1;
--eval CREATE TABLE t1 (a $type BYTE COMPRESSED)
SHOW CREATE TABLE t1;
DROP TABLE t1;

--disable_prepare_warnings

--echo #
--echo # The following statements fail by the grammar,
--echo # because COMPRESSED immediately follows  'field_type'.
--echo #

--error ER_PARSE_ERROR
--eval CREATE TABLE t1 (a $type COMPRESSED BYTE COMPRESSED)
--error ER_PARSE_ERROR
--eval CREATE TABLE t1 (a $type COMPRESSED BINARY COMPRESSED)
--error ER_PARSE_ERROR
--eval CREATE TABLE t1 (a $type COMPRESSED ASCII COMPRESSED)
--error ER_PARSE_ERROR
--eval CREATE TABLE t1 (a $type COMPRESSED CHARACTER SET utf8 COMPRESSED)


--echo #
--echo # The following statements are not prohibited by the *.yy grammar,
--echo # because the sequence `field_type attribute COMPRESSED` is allowed
--echo # (notice there is at least one attribute after `field_type`).
--echo # The first COMPRESSED is parsed inside `field_type`.
--echo # The second COMPRESSED passes through the parser but then is caught
--echo # inside Column_definition::set_compressed_deprecated_with_type_check()
--echo # and a syntax error is raised.
--echo #

--error ER_PARSE_ERROR
--eval CREATE TABLE t1 (a $type COMPRESSED BYTE DEFAULT '' COMPRESSED)
--error ER_PARSE_ERROR
--eval CREATE TABLE t1 (a $type COMPRESSED BINARY DEFAULT '' COMPRESSED)
--error ER_PARSE_ERROR
--eval CREATE TABLE t1 (a $type COMPRESSED ASCII DEFAULT '' COMPRESSED)
--error ER_PARSE_ERROR
--eval CREATE TABLE t1 (a $type COMPRESSED CHARACTER SET utf8 DEFAULT '' COMPRESSED)