1
############## mysql-test\t\max_sp_recursion_depth_basic.test ###############
3
# Variable Name: max_sp_recursion_depth #
4
# Scope: GLOBAL | SESSION #
5
# Access Type: Dynamic #
11
# Creation Date: 2008-02-07 #
14
# Description: Test Cases of Dynamic System Variable max_sp_recursion_depth #
15
# that checks the behavior of this variable in the following ways#
17
# * Valid & Invalid values #
18
# * Scope & Access method #
21
# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
22
# server-system-variables.html #
24
###############################################################################
26
--source include/load_sysvars.inc
29
############################################
30
# START OF max_sp_recursion_depth TESTS #
31
############################################
34
#############################################################
35
# Save initial value #
36
#############################################################
38
SET @start_global_value = @@global.max_sp_recursion_depth;
39
SELECT @start_global_value;
40
SET @start_session_value = @@session.max_sp_recursion_depth;
41
SELECT @start_session_value;
44
--echo '#--------------------FN_DYNVARS_085_01-------------------------#'
45
##############################################################
46
# Display the DEFAULT value of max_sp_recursion_depth #
47
##############################################################
49
SET @@global.max_sp_recursion_depth = 1000;
50
SET @@global.max_sp_recursion_depth = DEFAULT;
51
SELECT @@global.max_sp_recursion_depth;
54
SET @@session.max_sp_recursion_depth = 1000;
55
SET @@session.max_sp_recursion_depth = DEFAULT;
56
SELECT @@session.max_sp_recursion_depth;
59
--echo '#--------------------FN_DYNVARS_085_02-------------------------#'
60
##############################################################
61
# Check the DEFAULT value of max_sp_recursion_depth #
62
##############################################################
64
SET @@global.max_sp_recursion_depth = DEFAULT;
65
SELECT @@global.max_sp_recursion_depth = 0;
67
SET @@session.max_sp_recursion_depth = DEFAULT;
68
SELECT @@session.max_sp_recursion_depth = 0;
72
--echo '#--------------------FN_DYNVARS_085_03-------------------------#'
73
#########################################################################
74
# Change the value of max_sp_recursion_depth to a valid value for GLOBAL Scope #
75
#########################################################################
77
SET @@global.max_sp_recursion_depth = 0;
78
SELECT @@global.max_sp_recursion_depth;
79
SET @@global.max_sp_recursion_depth = 1;
80
SELECT @@global.max_sp_recursion_depth;
81
SET @@global.max_sp_recursion_depth = 254;
82
SELECT @@global.max_sp_recursion_depth;
83
SET @@global.max_sp_recursion_depth = 255;
84
SELECT @@global.max_sp_recursion_depth;
85
SET @@global.max_sp_recursion_depth = 150;
86
SELECT @@global.max_sp_recursion_depth;
88
--echo '#--------------------FN_DYNVARS_085_04-------------------------#'
89
#################################################################################
90
# Change the value of max_sp_recursion_depth to a valid value for SESSION Scope #
91
#################################################################################
93
SET @@session.max_sp_recursion_depth = 0;
94
SELECT @@session.max_sp_recursion_depth;
96
SET @@session.max_sp_recursion_depth = 1;
97
SELECT @@session.max_sp_recursion_depth;
99
SET @@session.max_sp_recursion_depth = 254;
100
SELECT @@session.max_sp_recursion_depth;
102
SET @@session.max_sp_recursion_depth = 255;
103
SELECT @@session.max_sp_recursion_depth;
105
SET @@session.max_sp_recursion_depth = 150;
106
SELECT @@session.max_sp_recursion_depth;
109
--echo '#------------------FN_DYNVARS_085_05-----------------------#'
110
##################################################################
111
# Change the value of max_sp_recursion_depth to an invalid value #
112
##################################################################
114
SET @@global.max_sp_recursion_depth = -1024;
115
SELECT @@global.max_sp_recursion_depth;
116
SET @@global.max_sp_recursion_depth = 256;
117
SELECT @@global.max_sp_recursion_depth;
118
SET @@global.max_sp_recursion_depth = -1;
119
SELECT @@global.max_sp_recursion_depth;
120
SET @@global.max_sp_recursion_depth = 3000;
121
SELECT @@global.max_sp_recursion_depth;
122
--Error ER_PARSE_ERROR
123
SET @@global.max_sp_recursion_depth = 65530.34.;
124
SELECT @@global.max_sp_recursion_depth;
125
--Error ER_WRONG_TYPE_FOR_VAR
126
SET @@global.max_sp_recursion_depth = test;
127
SELECT @@global.max_sp_recursion_depth;
129
SET @@session.max_sp_recursion_depth = 256;
130
SELECT @@session.max_sp_recursion_depth;
131
SET @@session.max_sp_recursion_depth = -1;
132
SELECT @@session.max_sp_recursion_depth;
133
SET @@session.max_sp_recursion_depth = 500000;
134
SELECT @@session.max_sp_recursion_depth;
135
SET @@session.max_sp_recursion_depth = -001;
136
SELECT @@session.max_sp_recursion_depth;
137
--Error ER_PARSE_ERROR
138
SET @@session.max_sp_recursion_depth = 65530.34.;
139
SET @@session.max_sp_recursion_depth = 10737418241;
140
SELECT @@session.max_sp_recursion_depth;
141
--Error ER_WRONG_TYPE_FOR_VAR
142
SET @@session.max_sp_recursion_depth = test;
143
SELECT @@session.max_sp_recursion_depth;
146
--echo '#------------------FN_DYNVARS_085_06-----------------------#'
147
####################################################################
148
# Check if the value in GLOBAL Table matches value in variable #
149
####################################################################
152
SELECT @@global.max_sp_recursion_depth = VARIABLE_VALUE
153
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
154
WHERE VARIABLE_NAME='max_sp_recursion_depth';
156
--echo '#------------------FN_DYNVARS_085_07-----------------------#'
157
####################################################################
158
# Check if the value in SESSION Table matches value in variable #
159
####################################################################
161
SELECT @@session.max_sp_recursion_depth = VARIABLE_VALUE
162
FROM INFORMATION_SCHEMA.SESSION_VARIABLES
163
WHERE VARIABLE_NAME='max_sp_recursion_depth';
166
--echo '#------------------FN_DYNVARS_085_08-----------------------#'
167
####################################################################
168
# Check if TRUE and FALSE values can be used on variable #
169
####################################################################
171
SET @@global.max_sp_recursion_depth = TRUE;
172
SELECT @@global.max_sp_recursion_depth;
173
SET @@global.max_sp_recursion_depth = FALSE;
174
SELECT @@global.max_sp_recursion_depth;
177
--echo '#---------------------FN_DYNVARS_085_09----------------------#'
178
#################################################################################
179
# Check if accessing variable with and without GLOBAL point to same variable #
180
#################################################################################
182
SET @@global.max_sp_recursion_depth = 20;
183
SELECT @@max_sp_recursion_depth = @@global.max_sp_recursion_depth;
186
--echo '#---------------------FN_DYNVARS_085_10----------------------#'
187
########################################################################################################
188
# Check if accessing variable with SESSION,LOCAL and without SCOPE points to same session variable #
189
########################################################################################################
191
SET @@max_sp_recursion_depth = 255;
192
SELECT @@max_sp_recursion_depth = @@local.max_sp_recursion_depth;
193
SELECT @@local.max_sp_recursion_depth = @@session.max_sp_recursion_depth;
196
--echo '#---------------------FN_DYNVARS_085_11----------------------#'
197
##########################################################################
198
# Check if max_sp_recursion_depth can be accessed with and without @@ sign #
199
##########################################################################
202
SET max_sp_recursion_depth = 102;
203
SELECT @@max_sp_recursion_depth;
204
--Error ER_UNKNOWN_TABLE
205
SELECT local.max_sp_recursion_depth;
206
--Error ER_UNKNOWN_TABLE
207
SELECT session.max_sp_recursion_depth;
208
--Error ER_BAD_FIELD_ERROR
209
SELECT max_sp_recursion_depth = @@session.max_sp_recursion_depth;
212
####################################
213
# Restore initial value #
214
####################################
216
SET @@global.max_sp_recursion_depth = @start_global_value;
217
SELECT @@global.max_sp_recursion_depth;
218
SET @@session.max_sp_recursion_depth = @start_session_value;
219
SELECT @@session.max_sp_recursion_depth;
222
####################################################
223
# END OF max_sp_recursion_depth TESTS #
224
####################################################