1
SET @start_value= @@global.max_sort_length;
2
SET @session_max_sort_length = @@Session.max_sort_length;
3
DROP TABLE IF EXISTS t;
7
id INT AUTO_INCREMENT PRIMARY KEY,
12
id INT AUTO_INCREMENT PRIMARY KEY,
17
id INT AUTO_INCREMENT PRIMARY KEY,
20
'#--------------------FN_DYNVARS_098_01-------------------------#'
21
** Connecting test_con1 using username 'root' **
22
** Connection test_con1 **
23
SELECT @@global.max_sort_length = 10;
24
@@global.max_sort_length = 10
26
SELECT @@session.max_sort_length = 10;
27
@@session.max_sort_length = 10
29
** Setting value to 30 and inserting data **
30
SET @@global.max_sort_length = 30;
31
SELECT @@global.max_sort_length;
32
@@global.max_sort_length
34
INSERT INTO t set c = repeat('x',29);
35
INSERT INTO t set c = concat(repeat('x',28),'r','x');
36
INSERT INTO t set c = concat(repeat('x',28),'s','y');
37
INSERT INTO t set c = concat(repeat('x',28),'g','w');
38
SELECT c from t ORDER BY c, id;
40
xxxxxxxxxxxxxxxxxxxxxxxxxxxxgw
41
xxxxxxxxxxxxxxxxxxxxxxxxxxxxrx
42
xxxxxxxxxxxxxxxxxxxxxxxxxxxxsy
43
xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
44
** Results should be sorted **
45
SET @@session.max_sort_length = 29;
46
SELECT @@session.max_sort_length;
47
@@session.max_sort_length
49
INSERT INTO t set c = repeat('x',29);
50
INSERT INTO t set c = concat(repeat('x',28),'r','x');
51
INSERT INTO t set c = concat(repeat('x',28),'s','y');
52
INSERT INTO t set c = concat(repeat('x',28),'g','w');
53
SELECT c from t ORDER BY c, id;
55
xxxxxxxxxxxxxxxxxxxxxxxxxxxxgw
56
xxxxxxxxxxxxxxxxxxxxxxxxxxxxgw
57
xxxxxxxxxxxxxxxxxxxxxxxxxxxxrx
58
xxxxxxxxxxxxxxxxxxxxxxxxxxxxrx
59
xxxxxxxxxxxxxxxxxxxxxxxxxxxxsy
60
xxxxxxxxxxxxxxxxxxxxxxxxxxxxsy
61
xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
62
xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
63
** Results should be sorted **
64
'#--------------------FN_DYNVARS_098_02-------------------------#'
65
** Connecting test_con2 using username 'root' **
66
** Connection test_con2 **
67
SET @@global.max_sort_length = 30;
68
SELECT @@global.max_sort_length;
69
@@global.max_sort_length
71
INSERT INTO t set c = repeat('x',29);
72
INSERT INTO t set c = concat(repeat('x',28),'r','x');
73
INSERT INTO t set c = concat(repeat('x',28),'s','y');
74
INSERT INTO t set c = concat(repeat('x',28),'g','w');
75
SELECT c from t ORDER BY c, id;
77
xxxxxxxxxxxxxxxxxxxxxxxxxxxxgw
78
xxxxxxxxxxxxxxxxxxxxxxxxxxxxgw
79
xxxxxxxxxxxxxxxxxxxxxxxxxxxxgw
80
xxxxxxxxxxxxxxxxxxxxxxxxxxxxrx
81
xxxxxxxxxxxxxxxxxxxxxxxxxxxxrx
82
xxxxxxxxxxxxxxxxxxxxxxxxxxxxrx
83
xxxxxxxxxxxxxxxxxxxxxxxxxxxxsy
84
xxxxxxxxxxxxxxxxxxxxxxxxxxxxsy
85
xxxxxxxxxxxxxxxxxxxxxxxxxxxxsy
86
xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
87
xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
88
xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
89
** Results should be sorted **
90
SET @@session.max_sort_length = 20;
91
SELECT @@session.max_sort_length;
92
@@session.max_sort_length
94
INSERT INTO t set c = repeat('x',29);
95
INSERT INTO t set c = concat(repeat('x',28),'r','x');
96
INSERT INTO t set c = concat(repeat('x',28),'s','y');
97
INSERT INTO t set c = concat(repeat('x',28),'g','w');
98
SELECT c from t ORDER BY c, id;
100
xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
101
xxxxxxxxxxxxxxxxxxxxxxxxxxxxrx
102
xxxxxxxxxxxxxxxxxxxxxxxxxxxxsy
103
xxxxxxxxxxxxxxxxxxxxxxxxxxxxgw
104
xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
105
xxxxxxxxxxxxxxxxxxxxxxxxxxxxrx
106
xxxxxxxxxxxxxxxxxxxxxxxxxxxxsy
107
xxxxxxxxxxxxxxxxxxxxxxxxxxxxgw
108
xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
109
xxxxxxxxxxxxxxxxxxxxxxxxxxxxrx
110
xxxxxxxxxxxxxxxxxxxxxxxxxxxxsy
111
xxxxxxxxxxxxxxxxxxxxxxxxxxxxgw
112
xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
113
xxxxxxxxxxxxxxxxxxxxxxxxxxxxrx
114
xxxxxxxxxxxxxxxxxxxxxxxxxxxxsy
115
xxxxxxxxxxxxxxxxxxxxxxxxxxxxgw
116
** Results should not be sorted **
117
'#--------------------FN_DYNVARS_098_03-------------------------#'
118
SET max_sort_length=20;
119
INSERT INTO t set c = repeat('x',29);
120
INSERT INTO t set c = concat(repeat('x',28),'r','x');
121
INSERT INTO t set c = concat(repeat('x',28),'s','y');
122
INSERT INTO t set c = concat(repeat('x',28),'g','w');
123
SELECT c from t ORDER BY c, id;
125
xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
126
xxxxxxxxxxxxxxxxxxxxxxxxxxxxrx
127
xxxxxxxxxxxxxxxxxxxxxxxxxxxxsy
128
xxxxxxxxxxxxxxxxxxxxxxxxxxxxgw
129
xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
130
xxxxxxxxxxxxxxxxxxxxxxxxxxxxrx
131
xxxxxxxxxxxxxxxxxxxxxxxxxxxxsy
132
xxxxxxxxxxxxxxxxxxxxxxxxxxxxgw
133
xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
134
xxxxxxxxxxxxxxxxxxxxxxxxxxxxrx
135
xxxxxxxxxxxxxxxxxxxxxxxxxxxxsy
136
xxxxxxxxxxxxxxxxxxxxxxxxxxxxgw
137
xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
138
xxxxxxxxxxxxxxxxxxxxxxxxxxxxrx
139
xxxxxxxxxxxxxxxxxxxxxxxxxxxxsy
140
xxxxxxxxxxxxxxxxxxxxxxxxxxxxgw
141
xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
142
xxxxxxxxxxxxxxxxxxxxxxxxxxxxrx
143
xxxxxxxxxxxxxxxxxxxxxxxxxxxxsy
144
xxxxxxxxxxxxxxxxxxxxxxxxxxxxgw
145
** Results should not be sorted **
147
'#--------------------FN_DYNVARS_098_04-------------------------#'
148
SET max_sort_length=29;
149
SELECT c from t ORDER BY c, id;
151
xxxxxxxxxxxxxxxxxxxxxxxxxxxxgw
152
xxxxxxxxxxxxxxxxxxxxxxxxxxxxgw
153
xxxxxxxxxxxxxxxxxxxxxxxxxxxxgw
154
xxxxxxxxxxxxxxxxxxxxxxxxxxxxgw
155
xxxxxxxxxxxxxxxxxxxxxxxxxxxxgw
156
xxxxxxxxxxxxxxxxxxxxxxxxxxxxrx
157
xxxxxxxxxxxxxxxxxxxxxxxxxxxxrx
158
xxxxxxxxxxxxxxxxxxxxxxxxxxxxrx
159
xxxxxxxxxxxxxxxxxxxxxxxxxxxxrx
160
xxxxxxxxxxxxxxxxxxxxxxxxxxxxrx
161
xxxxxxxxxxxxxxxxxxxxxxxxxxxxsy
162
xxxxxxxxxxxxxxxxxxxxxxxxxxxxsy
163
xxxxxxxxxxxxxxxxxxxxxxxxxxxxsy
164
xxxxxxxxxxxxxxxxxxxxxxxxxxxxsy
165
xxxxxxxxxxxxxxxxxxxxxxxxxxxxsy
166
xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
167
xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
168
xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
169
xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
170
xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
171
** Results should be sorted **
172
'#--------------------FN_DYNVARS_098_05-------------------------#'
173
SET max_sort_length=30;
174
SELECT c from t ORDER BY c, id;
176
xxxxxxxxxxxxxxxxxxxxxxxxxxxxgw
177
xxxxxxxxxxxxxxxxxxxxxxxxxxxxgw
178
xxxxxxxxxxxxxxxxxxxxxxxxxxxxgw
179
xxxxxxxxxxxxxxxxxxxxxxxxxxxxgw
180
xxxxxxxxxxxxxxxxxxxxxxxxxxxxgw
181
xxxxxxxxxxxxxxxxxxxxxxxxxxxxrx
182
xxxxxxxxxxxxxxxxxxxxxxxxxxxxrx
183
xxxxxxxxxxxxxxxxxxxxxxxxxxxxrx
184
xxxxxxxxxxxxxxxxxxxxxxxxxxxxrx
185
xxxxxxxxxxxxxxxxxxxxxxxxxxxxrx
186
xxxxxxxxxxxxxxxxxxxxxxxxxxxxsy
187
xxxxxxxxxxxxxxxxxxxxxxxxxxxxsy
188
xxxxxxxxxxxxxxxxxxxxxxxxxxxxsy
189
xxxxxxxxxxxxxxxxxxxxxxxxxxxxsy
190
xxxxxxxxxxxxxxxxxxxxxxxxxxxxsy
191
xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
192
xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
193
xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
194
xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
195
xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
196
** Results should be sorted **
197
'#--------------------FN_DYNVARS_098_06-------------------------#'
198
SET max_sort_length=default;
199
SELECT c from t ORDER BY c, id;
201
xxxxxxxxxxxxxxxxxxxxxxxxxxxxgw
202
xxxxxxxxxxxxxxxxxxxxxxxxxxxxgw
203
xxxxxxxxxxxxxxxxxxxxxxxxxxxxgw
204
xxxxxxxxxxxxxxxxxxxxxxxxxxxxgw
205
xxxxxxxxxxxxxxxxxxxxxxxxxxxxgw
206
xxxxxxxxxxxxxxxxxxxxxxxxxxxxrx
207
xxxxxxxxxxxxxxxxxxxxxxxxxxxxrx
208
xxxxxxxxxxxxxxxxxxxxxxxxxxxxrx
209
xxxxxxxxxxxxxxxxxxxxxxxxxxxxrx
210
xxxxxxxxxxxxxxxxxxxxxxxxxxxxrx
211
xxxxxxxxxxxxxxxxxxxxxxxxxxxxsy
212
xxxxxxxxxxxxxxxxxxxxxxxxxxxxsy
213
xxxxxxxxxxxxxxxxxxxxxxxxxxxxsy
214
xxxxxxxxxxxxxxxxxxxxxxxxxxxxsy
215
xxxxxxxxxxxxxxxxxxxxxxxxxxxxsy
216
xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
217
xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
218
xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
219
xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
220
xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
221
** Results should be sorted **
222
'#--------------------FN_DYNVARS_098_07-------------------------#'
224
SET @@global.max_sort_length = 30;
225
SELECT @@global.max_sort_length;
226
@@global.max_sort_length
228
INSERT INTO t1 set c = repeat('x',29);
229
INSERT INTO t1 set c = concat(repeat('x',28),'r','x');
230
INSERT INTO t1 set c = concat(repeat('x',28),'s','y');
231
INSERT INTO t1 set c = concat(repeat('x',28),'g','w');
232
SELECT c from t1 ORDER BY c, id;
234
xxxxxxxxxxxxxxxxxxxxxxxxxxxxgw
235
xxxxxxxxxxxxxxxxxxxxxxxxxxxxrx
236
xxxxxxxxxxxxxxxxxxxxxxxxxxxxsy
237
xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
238
** Results should be sorted **
239
SET @@session.max_sort_length = 20;
240
SELECT @@session.max_sort_length;
241
@@session.max_sort_length
243
INSERT INTO t1 set c = repeat('x',29);
244
INSERT INTO t1 set c = concat(repeat('x',28),'r','x');
245
INSERT INTO t1 set c = concat(repeat('x',28),'s','y');
246
INSERT INTO t1 set c = concat(repeat('x',28),'g','w');
247
SELECT c from t1 ORDER BY c, id;
249
xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
250
xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
251
xxxxxxxxxxxxxxxxxxxxxxxxxxxxrx
252
xxxxxxxxxxxxxxxxxxxxxxxxxxxxsy
253
xxxxxxxxxxxxxxxxxxxxxxxxxxxxgw
254
xxxxxxxxxxxxxxxxxxxxxxxxxxxxrx
255
xxxxxxxxxxxxxxxxxxxxxxxxxxxxsy
256
xxxxxxxxxxxxxxxxxxxxxxxxxxxxgw
257
** Results should not be sorted **
258
'#--------------------FN_DYNVARS_098_08-------------------------#'
260
SET @@global.max_sort_length = 30;
261
SELECT @@global.max_sort_length;
262
@@global.max_sort_length
264
INSERT INTO t2 set c = repeat('x',29);
265
INSERT INTO t2 set c = concat(repeat('x',28),'r','x');
266
INSERT INTO t2 set c = concat(repeat('x',28),'s','y');
267
INSERT INTO t2 set c = concat(repeat('x',28),'g','w');
268
SELECT c from t2 ORDER BY c, id;
270
xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
271
xxxxxxxxxxxxxxxxxxxxxxxxxxxxrx
272
xxxxxxxxxxxxxxxxxxxxxxxxxxxxsy
273
xxxxxxxxxxxxxxxxxxxxxxxxxxxxgw
274
** Results should not be sorted **
275
SET @@session.max_sort_length = 20;
276
SELECT @@session.max_sort_length;
277
@@session.max_sort_length
279
INSERT INTO t2 set c = repeat('x',29);
280
INSERT INTO t2 set c = concat(repeat('x',28),'r','x');
281
INSERT INTO t2 set c = concat(repeat('x',28),'s','y');
282
INSERT INTO t2 set c = concat(repeat('x',28),'g','w');
283
SELECT c from t2 ORDER BY c, id;
285
xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
286
xxxxxxxxxxxxxxxxxxxxxxxxxxxxrx
287
xxxxxxxxxxxxxxxxxxxxxxxxxxxxsy
288
xxxxxxxxxxxxxxxxxxxxxxxxxxxxgw
289
xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
290
xxxxxxxxxxxxxxxxxxxxxxxxxxxxrx
291
xxxxxxxxxxxxxxxxxxxxxxxxxxxxsy
292
xxxxxxxxxxxxxxxxxxxxxxxxxxxxgw
293
** Results should not be sorted **
294
** Connection default **
295
** Disconnecting test_con1, test_con2 **
296
SET @@SESSION.max_sort_length = @session_max_sort_length;
297
DROP TABLE IF EXISTS t;
298
DROP TABLE IF EXISTS t1;
299
DROP TABLE IF EXISTS t2;
300
SET @@global.max_sort_length= @start_value;