MySQL 5.6.14 Source Code Document
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
max_tmp_tables_basic.inc
1 ############## mysql-test\t\max_tmp_tables_basic.test ###############
2 # #
3 # Variable Name: max_tmp_tables #
4 # Scope: GLOBAL | SESSION #
5 # Access Type: Dynamic #
6 # Data Type: numeric #
7 # Default Value: 32 #
8 # Range: 1-4294967295 #
9 # #
10 # #
11 # #
12 # #
13 # #
14 # Creation Date: 2008-02-07 #
15 # Author: Salman #
16 # #
17 # Description: Test Cases of Dynamic System Variable max_tmp_tables #
18 # that checks the behavior of this variable in the following ways#
19 # * Default Value #
20 # * Valid & Invalid values #
21 # * Scope & Access method #
22 # * Data Integrity #
23 # #
24 # Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
25 # server-system-variables.html #
26 # #
27 ###############################################################################
28 
29 --source include/load_sysvars.inc
30 
31 ####################################
32 # START OF max_tmp_tables TESTS #
33 ####################################
34 
35 
36 #############################################################
37 # Save initial value #
38 #############################################################
39 
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;
44 
45 
46 --echo '#--------------------FN_DYNVARS_086_01-------------------------#'
47 ######################################################
48 # Display the DEFAULT value of max_tmp_tables #
49 ######################################################
50 
51 SET @@global.max_tmp_tables = 1000;
52 SET @@global.max_tmp_tables = DEFAULT;
53 SELECT @@global.max_tmp_tables;
54 
55 
56 SET @@session.max_tmp_tables = 1000;
57 SET @@session.max_tmp_tables = DEFAULT;
58 SELECT @@session.max_tmp_tables;
59 
60 
61 --echo '#--------------------FN_DYNVARS_086_02-------------------------#'
62 ######################################################
63 # Check the DEFAULT value of max_tmp_tables #
64 ######################################################
65 
66 SET @@global.max_tmp_tables = DEFAULT;
67 SELECT @@global.max_tmp_tables = 32;
68 
69 SET @@session.max_tmp_tables = DEFAULT;
70 SELECT @@session.max_tmp_tables = 32;
71 
72 
73 
74 --echo '#--------------------FN_DYNVARS_086_03-------------------------#'
75 ########################################################################
76 # Change the value of max_tmp_tables to a valid value for GLOBAL Scope #
77 ########################################################################
78 
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;
89 
90 --echo '#--------------------FN_DYNVARS_086_04-------------------------#'
91 #########################################################################
92 # Change the value of max_tmp_tables to a valid value for SESSION Scope #
93 #########################################################################
94 
95 SET @@session.max_tmp_tables = 1;
96 SELECT @@session.max_tmp_tables;
97 
98 SET @@session.max_tmp_tables = 2;
99 SELECT @@session.max_tmp_tables;
100 
101 SET @@session.max_tmp_tables = 65536;
102 SELECT @@session.max_tmp_tables;
103 
104 SET @@session.max_tmp_tables = 4294967295;
105 SELECT @@session.max_tmp_tables;
106 
107 SET @@session.max_tmp_tables = 4294967294;
108 SELECT @@session.max_tmp_tables;
109 
110 
111 --echo '#------------------FN_DYNVARS_086_05-----------------------#'
112 ##########################################################
113 # Change the value of max_tmp_tables to an invalid value #
114 ##########################################################
115 
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;
130 
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;
146 
147 
148 --echo '#------------------FN_DYNVARS_086_06-----------------------#'
149 ####################################################################
150 # Check if the value in GLOBAL Table matches value in variable #
151 ####################################################################
152 
153 
154 SELECT @@global.max_tmp_tables = VARIABLE_VALUE
155 FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
156 WHERE VARIABLE_NAME='max_tmp_tables';
157 
158 --echo '#------------------FN_DYNVARS_086_07-----------------------#'
159 ####################################################################
160 # Check if the value in SESSION Table matches value in variable #
161 ####################################################################
162 
163 SELECT @@session.max_tmp_tables = VARIABLE_VALUE
164 FROM INFORMATION_SCHEMA.SESSION_VARIABLES
165 WHERE VARIABLE_NAME='max_tmp_tables';
166 
167 
168 --echo '#------------------FN_DYNVARS_086_08-----------------------#'
169 ####################################################################
170 # Check if TRUE and FALSE values can be used on variable #
171 ####################################################################
172 
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;
177 
178 
179 --echo '#---------------------FN_DYNVARS_086_09----------------------#'
180 #################################################################################
181 # Check if accessing variable with and without GLOBAL point to same variable #
182 #################################################################################
183 
184 SET @@global.max_tmp_tables = 20;
185 SELECT @@max_tmp_tables = @@global.max_tmp_tables;
186 
187 
188 --echo '#---------------------FN_DYNVARS_086_10----------------------#'
189 ########################################################################################################
190 # Check if accessing variable with SESSION,LOCAL and without SCOPE points to same session variable #
191 ########################################################################################################
192 
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;
196 
197 
198 --echo '#---------------------FN_DYNVARS_086_11----------------------#'
199 #########################################################################
200 # Check if max_tmp_tables can be accessed with and without @@ sign #
201 #########################################################################
202 
203 
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;
212 
213 
214 ####################################
215 # Restore initial value #
216 ####################################
217 
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;
222 
223 
224 ###################################################
225 # END OF max_tmp_tables TESTS #
226 ###################################################
227