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
SET @@global.tmp_table_size = ON;
120
SET @@global.tmp_table_size = OFF;
123
SET @@global.tmp_table_size = True;
124
SELECT @@global.tmp_table_size;
126
SET @@global.tmp_table_size = False;
127
SELECT @@global.tmp_table_size;
128
--echo 'Bug:Error should be shown that variable is numeric and can not assigned boolean value';
131
SET @@global.tmp_table_size = 65530.34;
133
SET @@global.tmp_table_size ="Test";
136
SET @@session.tmp_table_size = ON;
139
SET @@session.tmp_table_size = OFF;
141
SET @@session.tmp_table_size = True;
142
SELECT @@session.tmp_table_size;
144
SET @@session.tmp_table_size = False;
145
SELECT @@session.tmp_table_size;
147
SET @@session.tmp_table_size = "Test";
149
SET @@session.tmp_table_size = 12345678901;
150
SELECT @@session.tmp_table_size;
153
--echo '#------------------FN_DYNVARS_005_06-----------------------#'
154
####################################################################
155
# Check if the value in GLOBAL Table matches value in variable #
156
####################################################################
159
SELECT @@global.tmp_table_size = VARIABLE_VALUE
160
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
161
WHERE VARIABLE_NAME='tmp_table_size';
163
--echo '#------------------FN_DYNVARS_005_07-----------------------#'
164
####################################################################
165
# Check if the value in SESSION Table matches value in variable #
166
####################################################################
168
SELECT @@session.tmp_table_size = VARIABLE_VALUE
169
FROM INFORMATION_SCHEMA.SESSION_VARIABLES
170
WHERE VARIABLE_NAME='tmp_table_size';
175
--echo '#---------------------FN_DYNVARS_001_09----------------------#'
176
########################################################################
177
# Check if global and session variables are independent of each other #
178
########################################################################
180
SET @@global.tmp_table_size = 1024;
181
SET @@tmp_table_size = 4294967295;
182
SELECT @@tmp_table_size = @@global.tmp_table_size;
184
--echo '#---------------------FN_DYNVARS_001_10----------------------#'
185
##################################################################
186
# Check if accessing variable with SESSION,LOCAL and without #
187
# SCOPE points to same session variable #
188
##################################################################
190
SET @@tmp_table_size = 100;
191
SELECT @@tmp_table_size = @@local.tmp_table_size;
192
SELECT @@local.tmp_table_size = @@session.tmp_table_size;
195
--echo '#---------------------FN_DYNVARS_001_11----------------------#'
196
#########################################################################
197
# Check if tmp_table_size can be accessed with and without @@ sign #
198
#########################################################################
200
SET tmp_table_size = 1027;
201
SELECT @@tmp_table_size;
203
--Error ER_UNKNOWN_TABLE
204
SELECT local.tmp_table_size;
206
--Error ER_UNKNOWN_TABLE
207
SELECT global.tmp_table_size;
209
--Error ER_BAD_FIELD_ERROR
210
SELECT tmp_table_size = @@session.tmp_table_size;
213
####################################
214
# Restore initial value #
215
####################################
217
SET @@global.tmp_table_size = @start_global_value;
218
SELECT @@global.tmp_table_size;
219
SET @@session.tmp_table_size = @start_session_value;
220
SELECT @@session.tmp_table_size;
223
###################################################
224
# END OF tmp_table_size TESTS #
225
###################################################