Debian Codegraph @

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

raw
1 ############## mysql-test\t\max_sort_length_basic.test ###############
2 # #
3 # Variable Name: max_sort_length #
4 # Scope: GLOBAL | SESSION #
5 # Access Type: Dynamic #
6 # Data Type: numeric #
7 # Default Value: 1024 #
8 # Range: 4-8388608 #
9 # #
10 # #
11 # Creation Date: 2008-02-07 #
12 # Author: Salman #
13 # #
14 # Description: Test Cases of Dynamic System Variable max_sort_length #
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 ############################################
30 # START OF max_sort_length TESTS #
31 ############################################
32
33
34 #############################################################
35 # Save initial value #
36 #############################################################
37
38 SET @start_global_value = @@global.max_sort_length;
39 SELECT @start_global_value;
40 SET @start_session_value = @@session.max_sort_length;
41 SELECT @start_session_value;
42
43
44 --echo '#--------------------FN_DYNVARS_084_01-------------------------#'
45 #######################################################
46 # Display the DEFAULT value of max_sort_length #
47 #######################################################
48
49 SET @@global.max_sort_length = 1000;
50 SET @@global.max_sort_length = DEFAULT;
51 SELECT @@global.max_sort_length;
52
53
54 SET @@session.max_sort_length = 1000;
55 SET @@session.max_sort_length = DEFAULT;
56 SELECT @@session.max_sort_length;
57
58
59 --echo '#--------------------FN_DYNVARS_084_02-------------------------#'
60 #######################################################
61 # Check the DEFAULT value of max_sort_length #
62 #######################################################
63
64 SET @@global.max_sort_length = DEFAULT;
65 SELECT @@global.max_sort_length = 1024;
66
67 SET @@session.max_sort_length = DEFAULT;
68 SELECT @@session.max_sort_length = 1024;
69
70
71
72 --echo '#--------------------FN_DYNVARS_084_03-------------------------#'
73 #########################################################################
74 # Change the value of max_sort_length to a valid value for GLOBAL Scope #
75 #########################################################################
76
77 SET @@global.max_sort_length = 4;
78 SELECT @@global.max_sort_length;
79 SET @@global.max_sort_length = 5;
80 SELECT @@global.max_sort_length;
81 SET @@global.max_sort_length = 8388608;
82 SELECT @@global.max_sort_length;
83 SET @@global.max_sort_length = 8388607;
84 SELECT @@global.max_sort_length;
85 SET @@global.max_sort_length = 65536;
86 SELECT @@global.max_sort_length;
87
88 --echo '#--------------------FN_DYNVARS_084_04-------------------------#'
89 ##########################################################################
90 # Change the value of max_sort_length to a valid value for SESSION Scope #
91 ##########################################################################
92
93 SET @@session.max_sort_length = 4;
94 SELECT @@session.max_sort_length;
95
96 SET @@session.max_sort_length = 5;
97 SELECT @@session.max_sort_length;
98
99 SET @@session.max_sort_length = 8388608;
100 SELECT @@session.max_sort_length;
101
102 SET @@session.max_sort_length = 8388607;
103 SELECT @@session.max_sort_length;
104
105 SET @@session.max_sort_length = 65536;
106 SELECT @@session.max_sort_length;
107
108
109 --echo '#------------------FN_DYNVARS_084_05-----------------------#'
110 ###########################################################
111 # Change the value of max_sort_length to an invalid value #
112 ###########################################################
113
114 SET @@global.max_sort_length = -1024;
115 SELECT @@global.max_sort_length;
116 SET @@global.max_sort_length = 3;
117 SELECT @@global.max_sort_length;
118 SET @@global.max_sort_length = 8388609;
119 SELECT @@global.max_sort_length;
120 SET @@global.max_sort_length = 0;
121 SELECT @@global.max_sort_length;
122 SET @@global.max_sort_length = 1075692835;
123 SELECT @@global.max_sort_length;
124
125 --Error ER_WRONG_TYPE_FOR_VAR
126 SET @@global.max_sort_length = 65530.34;
127 SELECT @@global.max_sort_length;
128 --Error ER_WRONG_TYPE_FOR_VAR
129 SET @@global.max_sort_length = test;
130 SELECT @@global.max_sort_length;
131 --Error ER_WRONG_TYPE_FOR_VAR
132 SET @@global.max_sort_length = ' ';
133 SELECT @@global.max_sort_length;
134
135 SET @@session.max_sort_length = 8388610;
136 SELECT @@session.max_sort_length;
137 SET @@session.max_sort_length = -1;
138 SELECT @@session.max_sort_length;
139 SET @@session.max_sort_length = 3;
140 SELECT @@session.max_sort_length;
141 SET @@session.max_sort_length = 0;
142 SELECT @@session.max_sort_length;
143 SET @@session.max_sort_length = -1024;
144 SELECT @@session.max_sort_length;
145
146 --Error ER_WRONG_TYPE_FOR_VAR
147 SET @@session.max_sort_length = 65530.34;
148 SET @@session.max_sort_length = 10737418241;
149 SELECT @@session.max_sort_length;
150 --Error ER_WRONG_TYPE_FOR_VAR
151 SET @@session.max_sort_length = test;
152 SELECT @@session.max_sort_length;
153 --Error ER_WRONG_TYPE_FOR_VAR
154 SET @@session.max_sort_length = ' ';
155 SELECT @@session.max_sort_length;
156
157
158 --echo '#------------------FN_DYNVARS_084_06-----------------------#'
159 ####################################################################
160 # Check if the value in GLOBAL Table matches value in variable #
161 ####################################################################
162
163
164 --disable_warnings
165 SELECT @@global.max_sort_length = VARIABLE_VALUE
166 FROM performance_schema.global_variables
167 WHERE VARIABLE_NAME='max_sort_length';
168 --enable_warnings
169
170 --echo '#------------------FN_DYNVARS_084_07-----------------------#'
171 ####################################################################
172 # Check if the value in SESSION Table matches value in variable #
173 ####################################################################
174
175 --disable_warnings
176 SELECT @@session.max_sort_length = VARIABLE_VALUE
177 FROM performance_schema.session_variables
178 WHERE VARIABLE_NAME='max_sort_length';
179 --enable_warnings
180
181
182 --echo '#------------------FN_DYNVARS_084_08-----------------------#'
183 ####################################################################
184 # Check if TRUE and FALSE values can be used on variable #
185 ####################################################################
186
187 SET @@global.max_sort_length = TRUE;
188 SELECT @@global.max_sort_length;
189 SET @@global.max_sort_length = FALSE;
190 SELECT @@global.max_sort_length;
191
192
193 --echo '#---------------------FN_DYNVARS_084_09----------------------#'
194 #################################################################################
195 # Check if accessing variable with and without GLOBAL point to same variable #
196 #################################################################################
197
198 SET @@global.max_sort_length = 2048;
199 SELECT @@max_sort_length = @@global.max_sort_length;
200
201
202 --echo '#---------------------FN_DYNVARS_084_10----------------------#'
203 ########################################################################################################
204 # Check if accessing variable with SESSION,LOCAL and without SCOPE points to same session variable #
205 ########################################################################################################
206
207 SET @@max_sort_length = 100000;
208 SELECT @@max_sort_length = @@local.max_sort_length;
209 SELECT @@local.max_sort_length = @@session.max_sort_length;
210
211
212 --echo '#---------------------FN_DYNVARS_084_11----------------------#'
213 ##########################################################################
214 # Check if max_sort_length can be accessed with and without @@ sign #
215 ##########################################################################
216
217
218 SET max_sort_length = 1024;
219 SELECT @@max_sort_length;
220 --Error ER_UNKNOWN_TABLE
221 SELECT local.max_sort_length;
222 --Error ER_UNKNOWN_TABLE
223 SELECT session.max_sort_length;
224 --Error ER_BAD_FIELD_ERROR
225 SELECT max_sort_length = @@session.max_sort_length;
226
227
228 ####################################
229 # Restore initial value #
230 ####################################
231
232 SET @@global.max_sort_length = @start_global_value;
233 SELECT @@global.max_sort_length;
234 SET @@session.max_sort_length = @start_session_value;
235 SELECT @@session.max_sort_length;
236
237
238 ####################################################
239 # END OF max_sort_length TESTS #
240 ####################################################
241