1
############## mysql-test\t\max_tmp_tables_basic.test ###############
3
# Variable Name: max_tmp_tables #
4
# Scope: GLOBAL | SESSION #
5
# Access Type: Dynamic #
8
# Range: 1-4294967295 #
14
# Creation Date: 2008-02-07 #
17
# Description: Test Cases of Dynamic System Variable max_tmp_tables #
18
# that checks the behavior of this variable in the following ways#
20
# * Valid & Invalid values #
21
# * Scope & Access method #
24
# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
25
# server-system-variables.html #
27
###############################################################################
29
--source include/load_sysvars.inc
31
####################################
32
# START OF max_tmp_tables TESTS #
33
####################################
36
#############################################################
37
# Save initial value #
38
#############################################################
40
SET @start_global_value = @@global.max_tmp_tables;
41
SELECT @start_global_value;
42
SET @start_session_value = @@session.max_tmp_tables;
43
SELECT @start_session_value;
46
--echo '#--------------------FN_DYNVARS_086_01-------------------------#'
47
######################################################
48
# Display the DEFAULT value of max_tmp_tables #
49
######################################################
51
SET @@global.max_tmp_tables = 1000;
52
SET @@global.max_tmp_tables = DEFAULT;
53
SELECT @@global.max_tmp_tables;
56
SET @@session.max_tmp_tables = 1000;
57
SET @@session.max_tmp_tables = DEFAULT;
58
SELECT @@session.max_tmp_tables;
61
--echo '#--------------------FN_DYNVARS_086_02-------------------------#'
62
######################################################
63
# Check the DEFAULT value of max_tmp_tables #
64
######################################################
66
SET @@global.max_tmp_tables = DEFAULT;
67
SELECT @@global.max_tmp_tables = 32;
69
SET @@session.max_tmp_tables = DEFAULT;
70
SELECT @@session.max_tmp_tables = 32;
74
--echo '#--------------------FN_DYNVARS_086_03-------------------------#'
75
########################################################################
76
# Change the value of max_tmp_tables to a valid value for GLOBAL Scope #
77
########################################################################
79
SET @@global.max_tmp_tables = 1;
80
SELECT @@global.max_tmp_tables;
81
SET @@global.max_tmp_tables = 2;
82
SELECT @@global.max_tmp_tables;
83
SET @@global.max_tmp_tables = 65536;
84
SELECT @@global.max_tmp_tables;
85
SET @@global.max_tmp_tables = 4294967295;
86
SELECT @@global.max_tmp_tables;
87
SET @@global.max_tmp_tables = 4294967294;
88
SELECT @@global.max_tmp_tables;
90
--echo '#--------------------FN_DYNVARS_086_04-------------------------#'
91
#########################################################################
92
# Change the value of max_tmp_tables to a valid value for SESSION Scope #
93
#########################################################################
95
SET @@session.max_tmp_tables = 1;
96
SELECT @@session.max_tmp_tables;
98
SET @@session.max_tmp_tables = 2;
99
SELECT @@session.max_tmp_tables;
101
SET @@session.max_tmp_tables = 65536;
102
SELECT @@session.max_tmp_tables;
104
SET @@session.max_tmp_tables = 4294967295;
105
SELECT @@session.max_tmp_tables;
107
SET @@session.max_tmp_tables = 4294967294;
108
SELECT @@session.max_tmp_tables;
111
--echo '#------------------FN_DYNVARS_086_05-----------------------#'
112
##########################################################
113
# Change the value of max_tmp_tables to an invalid value #
114
##########################################################
116
SET @@global.max_tmp_tables = -1024;
117
SELECT @@global.max_tmp_tables;
118
SET @@global.max_tmp_tables = 4294967296;
119
SELECT @@global.max_tmp_tables;
120
SET @@global.max_tmp_tables = -1;
121
SELECT @@global.max_tmp_tables;
122
SET @@global.max_tmp_tables = 429496729500;
123
SELECT @@global.max_tmp_tables;
124
--Error ER_WRONG_TYPE_FOR_VAR
125
SET @@global.max_tmp_tables = 65530.34;
126
SELECT @@global.max_tmp_tables;
127
--Error ER_WRONG_TYPE_FOR_VAR
128
SET @@global.max_tmp_tables = test;
129
SELECT @@global.max_tmp_tables;
131
SET @@session.max_tmp_tables = 4294967296;
132
SELECT @@session.max_tmp_tables;
133
SET @@session.max_tmp_tables = -1;
134
SELECT @@session.max_tmp_tables;
135
SET @@session.max_tmp_tables = 429496729500;
136
SELECT @@session.max_tmp_tables;
137
SET @@session.max_tmp_tables = -001;
138
SELECT @@session.max_tmp_tables;
139
--Error ER_WRONG_TYPE_FOR_VAR
140
SET @@session.max_tmp_tables = 65530.34;
141
SET @@session.max_tmp_tables = 10737418241;
142
SELECT @@session.max_tmp_tables;
143
--Error ER_WRONG_TYPE_FOR_VAR
144
SET @@session.max_tmp_tables = test;
145
SELECT @@session.max_tmp_tables;
148
--echo '#------------------FN_DYNVARS_086_06-----------------------#'
149
####################################################################
150
# Check if the value in GLOBAL Table matches value in variable #
151
####################################################################
154
SELECT @@global.max_tmp_tables = VARIABLE_VALUE
155
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
156
WHERE VARIABLE_NAME='max_tmp_tables';
158
--echo '#------------------FN_DYNVARS_086_07-----------------------#'
159
####################################################################
160
# Check if the value in SESSION Table matches value in variable #
161
####################################################################
163
SELECT @@session.max_tmp_tables = VARIABLE_VALUE
164
FROM INFORMATION_SCHEMA.SESSION_VARIABLES
165
WHERE VARIABLE_NAME='max_tmp_tables';
168
--echo '#------------------FN_DYNVARS_086_08-----------------------#'
169
####################################################################
170
# Check if TRUE and FALSE values can be used on variable #
171
####################################################################
173
SET @@global.max_tmp_tables = TRUE;
174
SELECT @@global.max_tmp_tables;
175
SET @@global.max_tmp_tables = FALSE;
176
SELECT @@global.max_tmp_tables;
179
--echo '#---------------------FN_DYNVARS_086_09----------------------#'
180
#################################################################################
181
# Check if accessing variable with and without GLOBAL point to same variable #
182
#################################################################################
184
SET @@global.max_tmp_tables = 20;
185
SELECT @@max_tmp_tables = @@global.max_tmp_tables;
188
--echo '#---------------------FN_DYNVARS_086_10----------------------#'
189
########################################################################################################
190
# Check if accessing variable with SESSION,LOCAL and without SCOPE points to same session variable #
191
########################################################################################################
193
SET @@max_tmp_tables = 255;
194
SELECT @@max_tmp_tables = @@local.max_tmp_tables;
195
SELECT @@local.max_tmp_tables = @@session.max_tmp_tables;
198
--echo '#---------------------FN_DYNVARS_086_11----------------------#'
199
#########################################################################
200
# Check if max_tmp_tables can be accessed with and without @@ sign #
201
#########################################################################
204
SET max_tmp_tables = 102;
205
SELECT @@max_tmp_tables;
206
--Error ER_UNKNOWN_TABLE
207
SELECT local.max_tmp_tables;
208
--Error ER_UNKNOWN_TABLE
209
SELECT session.max_tmp_tables;
210
--Error ER_BAD_FIELD_ERROR
211
SELECT max_tmp_tables = @@session.max_tmp_tables;
214
####################################
215
# Restore initial value #
216
####################################
218
SET @@global.max_tmp_tables = @start_global_value;
219
SELECT @@global.max_tmp_tables;
220
SET @@session.max_tmp_tables = @start_session_value;
221
SELECT @@session.max_tmp_tables;
224
###################################################
225
# END OF max_tmp_tables TESTS #
226
###################################################