Debian Codegraph @

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

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