Debian Codegraph @

mysql-test/suite/sys_vars/t/group_concat_max_len_basic.test

raw
1 ############## mysql-test\t\group_concat_max_len_basic.test ###############
2 # #
3 # Variable Name: group_concat_max_len #
4 # Scope: GLOBAL | SESSION #
5 # Access Type: Dynamic #
6 # Data Type: numeric #
7 # Default Value: 1024 #
8 # Minimum value: 4 #
9 # #
10 # #
11 # Creation Date: 2008-02-07 #
12 # Author: Salman #
13 # #
14 # Description: Test Cases of Dynamic System Variable group_concat_max_len #
15 # that checks the behavior of this variable in the following ways#
16 # * Default Value #
17 # * Valid & Invalid values #
18 # * Scope & Access method #
19 # * Data Integrity #
20 # #
21 # Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
22 # server-system-variables.html #
23 # #
24 ###############################################################################
25
26 --source include/load_sysvars.inc
27
28 ########################################################################
29 # START OF group_concat_max_len TESTS #
30 ########################################################################
31
32
33 #############################################################
34 # Save initial value #
35 #############################################################
36
37 SET @start_global_value = @@global.group_concat_max_len;
38 SELECT @start_global_value;
39 SET @start_session_value = @@session.group_concat_max_len;
40 SELECT @start_session_value;
41
42
43 --echo '#--------------------FN_DYNVARS_034_01-------------------------#'
44 ########################################################################
45 # Display the DEFAULT value of group_concat_max_len #
46 ########################################################################
47
48 SET @@global.group_concat_max_len = 100;
49 SET @@global.group_concat_max_len = DEFAULT;
50 SELECT @@global.group_concat_max_len;
51
52 SET @@session.group_concat_max_len = 200;
53 SET @@session.group_concat_max_len = DEFAULT;
54 SELECT @@session.group_concat_max_len;
55
56
57 --echo '#--------------------FN_DYNVARS_034_02-------------------------#'
58 ########################################################################
59 # Check the DEFAULT value of group_concat_max_len #
60 ########################################################################
61
62 SET @@global.group_concat_max_len = DEFAULT;
63 SELECT @@global.group_concat_max_len = 1;
64
65 SET @@session.group_concat_max_len = DEFAULT;
66 SELECT @@session.group_concat_max_len = 1;
67
68
69 --echo '#--------------------FN_DYNVARS_034_03-------------------------#'
70 ##################################################################################
71 # Change the value of group_concat_max_len to a valid value for GLOBAL Scope #
72 ##################################################################################
73
74 SET @@global.group_concat_max_len = 1;
75 SELECT @@global.group_concat_max_len;
76 SET @@global.group_concat_max_len = 60020;
77 SELECT @@global.group_concat_max_len;
78 SET @@global.group_concat_max_len = 65535;
79 SELECT @@global.group_concat_max_len;
80
81
82 --echo '#--------------------FN_DYNVARS_034_04-------------------------#'
83 ###################################################################################
84 # Change the value of group_concat_max_len to a valid value for SESSION Scope #
85 ###################################################################################
86
87 SET @@session.group_concat_max_len = 1;
88 SELECT @@session.group_concat_max_len;
89 SET @@session.group_concat_max_len = 50050;
90 SELECT @@session.group_concat_max_len;
91 SET @@session.group_concat_max_len = 65535;
92 SELECT @@session.group_concat_max_len;
93
94
95 --echo '#------------------FN_DYNVARS_034_05-----------------------#'
96 ####################################################################
97 # Change the value of group_concat_max_len to an invalid value #
98 ####################################################################
99
100 SET @@global.group_concat_max_len = 0;
101 SELECT @@global.group_concat_max_len;
102 SET @@global.group_concat_max_len = -1024;
103 SELECT @@global.group_concat_max_len;
104 SET @@global.group_concat_max_len = 65536;
105 SELECT @@global.group_concat_max_len;
106 --Error ER_WRONG_TYPE_FOR_VAR
107 SET @@global.group_concat_max_len = 65530.34;
108 SELECT @@global.group_concat_max_len;
109 --Error ER_WRONG_TYPE_FOR_VAR
110 SET @@global.group_concat_max_len = test;
111 SELECT @@global.group_concat_max_len;
112
113 SET @@session.group_concat_max_len = 0;
114 SELECT @@session.group_concat_max_len;
115 SET @@session.group_concat_max_len = -2;
116 SELECT @@session.group_concat_max_len;
117 --Error ER_WRONG_TYPE_FOR_VAR
118 SET @@session.group_concat_max_len = 65530.34;
119 SET @@session.group_concat_max_len = 65550;
120 SELECT @@session.group_concat_max_len;
121
122 --Error ER_WRONG_TYPE_FOR_VAR
123 SET @@session.group_concat_max_len = test;
124 SELECT @@session.group_concat_max_len;
125
126
127 --echo '#------------------FN_DYNVARS_034_06-----------------------#'
128 ####################################################################
129 # Check if the value in GLOBAL Table matches value in variable #
130 ####################################################################
131
132
133 --disable_warnings
134 SELECT @@global.group_concat_max_len = VARIABLE_VALUE
135 FROM performance_schema.global_variables
136 WHERE VARIABLE_NAME='group_concat_max_len';
137 --enable_warnings
138
139 --echo '#------------------FN_DYNVARS_034_07-----------------------#'
140 ####################################################################
141 # Check if the value in SESSION Table matches value in variable #
142 ####################################################################
143
144 --disable_warnings
145 SELECT @@session.group_concat_max_len = VARIABLE_VALUE
146 FROM performance_schema.session_variables
147 WHERE VARIABLE_NAME='group_concat_max_len';
148 --enable_warnings
149
150
151 --echo '#------------------FN_DYNVARS_034_08-----------------------#'
152 ####################################################################
153 # Check if TRUE and FALSE values can be used on variable #
154 ####################################################################
155
156 SET @@global.group_concat_max_len = TRUE;
157 SELECT @@global.group_concat_max_len;
158 SET @@global.group_concat_max_len = FALSE;
159 SELECT @@global.group_concat_max_len;
160
161
162 --echo '#---------------------FN_DYNVARS_001_09----------------------#'
163 ####################################################################################
164 # Check if accessing variable with and without GLOBAL point to same variable #
165 ####################################################################################
166
167 SET @@global.group_concat_max_len = 10;
168 SELECT @@group_concat_max_len = @@global.group_concat_max_len;
169
170
171 --echo '#---------------------FN_DYNVARS_001_10----------------------#'
172 ########################################################################################################
173 # Check if accessing variable with SESSION,LOCAL and without SCOPE points to same session variable #
174 ########################################################################################################
175
176 SET @@group_concat_max_len = 100;
177 SELECT @@group_concat_max_len = @@local.group_concat_max_len;
178 SELECT @@local.group_concat_max_len = @@session.group_concat_max_len;
179
180
181 --echo '#---------------------FN_DYNVARS_001_11----------------------#'
182 ###################################################################################
183 # Check if group_concat_max_len can be accessed with and without @@ sign #
184 ###################################################################################
185
186 SET group_concat_max_len = 1;
187 SELECT @@group_concat_max_len;
188 --Error ER_UNKNOWN_TABLE
189 SELECT local.group_concat_max_len;
190 --Error ER_UNKNOWN_TABLE
191 SELECT session.group_concat_max_len;
192 --Error ER_BAD_FIELD_ERROR
193 SELECT group_concat_max_len = @@session.group_concat_max_len;
194
195
196 ####################################
197 # Restore initial value #
198 ####################################
199
200 SET @@global.group_concat_max_len = @start_global_value;
201 SELECT @@global.group_concat_max_len;
202 SET @@session.group_concat_max_len = @start_session_value;
203 SELECT @@session.group_concat_max_len;
204
205
206 #############################################################
207 # END OF group_concat_max_len TESTS #
208 #############################################################
209