1
############## mysql-test\t\tmp_table_size_basic.test #########################
3
# Variable Name: tmp_table_size #
4
# Scope: GLOBAL | SESSION #
5
# Access Type: Dynamic #
7
# Default Value: 33554432 #
8
# Range: 1024-4294967295 #
11
# Creation Date: 2008-02-13 #
14
# Description: Test Cases of Dynamic System Variable tmp_table_size #
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#option_mysqld_tmp_table_size #
24
###############################################################################
26
--source include/load_sysvars.inc
28
##############################################################
29
# START OF tmp_table_size TESTS #
30
##############################################################
33
#############################################################
34
# Save initial value #
35
#############################################################
37
SET @start_global_value = @@global.tmp_table_size;
38
SELECT @start_global_value;
39
SET @start_session_value = @@session.tmp_table_size;
40
SELECT @start_session_value;
42
--echo 'Bug# 34876: This variable has invalid default value as compared to documentation';
44
--echo '#--------------------FN_DYNVARS_005_01-------------------------#'
45
##############################################################
46
# Display the DEFAULT value of tmp_table_size #
47
##############################################################
49
SET @@global.tmp_table_size = 100;
50
SET @@global.tmp_table_size = DEFAULT;
51
SELECT @@global.tmp_table_size;
53
--echo 'Bug# 34876: This variable has invalid default value as compared to documentation';
54
SET @@session.tmp_table_size = 200;
55
SET @@session.tmp_table_size = DEFAULT;
56
SELECT @@session.tmp_table_size;
57
--echo 'Bug# 34876: This variable has invalid default value as compared to documentation';
60
--echo '#--------------------FN_DYNVARS_005_02-------------------------#'
61
########################################################################
62
# Check the DEFAULT value of tmp_table_size #
63
########################################################################
65
SET @@global.tmp_table_size = DEFAULT;
66
SELECT @@global.tmp_table_size = 33554432;
68
SET @@session.tmp_table_size = DEFAULT;
69
SELECT @@session.tmp_table_size = 33554432;
71
--echo 'Bug# 34876: This variable has invalid default value as compared to documentation';
73
--echo '#--------------------FN_DYNVARS_005_03-------------------------#'
74
########################################################################
75
# Change the value of tmp_table_size to a valid value for GLOBAL Scope #
76
########################################################################
78
SET @@global.tmp_table_size = 1024;
79
SELECT @@global.tmp_table_size;
80
SET @@global.tmp_table_size = 60020;
81
SELECT @@global.tmp_table_size;
82
SET @@global.tmp_table_size = 4294967295;
83
SELECT @@global.tmp_table_size;
86
--echo '#--------------------FN_DYNVARS_005_04-------------------------#'
87
#########################################################################
88
# Change the value of tmp_table_size to a valid value for SESSION Scope #
89
#########################################################################
91
SET @@session.tmp_table_size = 1024;
92
SELECT @@session.tmp_table_size;
94
SET @@session.tmp_table_size =4294967295;
95
SELECT @@session.tmp_table_size;
96
SET @@session.tmp_table_size = 65535;
97
SELECT @@session.tmp_table_size;
100
--echo '#------------------FN_DYNVARS_005_05-----------------------#'
101
##########################################################
102
# Change the value of tmp_table_size to an invalid value #
103
##########################################################
105
SET @@global.tmp_table_size = 0;
106
SELECT @@global.tmp_table_size;
108
SET @@global.tmp_table_size = -1024;
109
SELECT @@global.tmp_table_size;
111
SET @@global.tmp_table_size = 1000;
112
SELECT @@global.tmp_table_size;
114
--echo 'Bug # 34837: Errors are not coming on assigning invalid values to variable';
117
-- Error ER_WRONG_TYPE_FOR_VAR
118
SET @@global.tmp_table_size = ON;
121
-- Error ER_WRONG_TYPE_FOR_VAR
122
SET @@global.tmp_table_size = OFF;
125
SET @@global.tmp_table_size = True;
126
SELECT @@global.tmp_table_size;
128
SET @@global.tmp_table_size = False;
129
SELECT @@global.tmp_table_size;
130
--echo 'Bug:Error should be shown that variable is numeric and can not assigned boolean value';
133
-- Error ER_WRONG_TYPE_FOR_VAR
134
SET @@global.tmp_table_size = 65530.34;
136
-- Error ER_WRONG_TYPE_FOR_VAR
137
SET @@global.tmp_table_size ="Test";
140
-- Error ER_WRONG_TYPE_FOR_VAR
141
SET @@session.tmp_table_size = ON;
144
-- Error ER_WRONG_TYPE_FOR_VAR
145
SET @@session.tmp_table_size = OFF;
147
SET @@session.tmp_table_size = True;
148
SELECT @@session.tmp_table_size;
150
SET @@session.tmp_table_size = False;
151
SELECT @@session.tmp_table_size;
153
-- Error ER_WRONG_TYPE_FOR_VAR
154
SET @@session.tmp_table_size = "Test";
156
SET @@session.tmp_table_size = 12345678901;
157
SELECT @@session.tmp_table_size;
160
--echo '#------------------FN_DYNVARS_005_06-----------------------#'
161
####################################################################
162
# Check if the value in GLOBAL Table matches value in variable #
163
####################################################################
166
SELECT @@global.tmp_table_size = VARIABLE_VALUE
167
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
168
WHERE VARIABLE_NAME='tmp_table_size';
170
--echo '#------------------FN_DYNVARS_005_07-----------------------#'
171
####################################################################
172
# Check if the value in SESSION Table matches value in variable #
173
####################################################################
175
SELECT @@session.tmp_table_size = VARIABLE_VALUE
176
FROM INFORMATION_SCHEMA.SESSION_VARIABLES
177
WHERE VARIABLE_NAME='tmp_table_size';
182
--echo '#---------------------FN_DYNVARS_001_09----------------------#'
183
########################################################################
184
# Check if global and session variables are independent of each other #
185
########################################################################
187
SET @@global.tmp_table_size = 1024;
188
SET @@tmp_table_size = 4294967295;
189
SELECT @@tmp_table_size = @@global.tmp_table_size;
191
--echo '#---------------------FN_DYNVARS_001_10----------------------#'
192
##################################################################
193
# Check if accessing variable with SESSION,LOCAL and without #
194
# SCOPE points to same session variable #
195
##################################################################
197
SET @@tmp_table_size = 100;
198
SELECT @@tmp_table_size = @@local.tmp_table_size;
199
SELECT @@local.tmp_table_size = @@session.tmp_table_size;
202
--echo '#---------------------FN_DYNVARS_001_11----------------------#'
203
#########################################################################
204
# Check if tmp_table_size can be accessed with and without @@ sign #
205
#########################################################################
207
SET tmp_table_size = 1027;
208
SELECT @@tmp_table_size;
210
--Error ER_UNKNOWN_TABLE
211
SELECT local.tmp_table_size;
213
--Error ER_UNKNOWN_TABLE
214
SELECT global.tmp_table_size;
216
--Error ER_BAD_FIELD_ERROR
217
SELECT tmp_table_size = @@session.tmp_table_size;
220
####################################
221
# Restore initial value #
222
####################################
224
SET @@global.tmp_table_size = @start_global_value;
225
SELECT @@global.tmp_table_size;
226
SET @@session.tmp_table_size = @start_session_value;
227
SELECT @@session.tmp_table_size;
230
###################################################
231
# END OF tmp_table_size TESTS #
232
###################################################