~maria-captains/maria/mysql-6.0-backup

« back to all changes in this revision

Viewing changes to mysql-test/r/ctype_binary.result

  • Committer: Thava Alagu
  • Date: 2010-03-11 19:18:17 UTC
  • mfrom: (3719.14.62 mysql-6.0-codebase)
  • Revision ID: thavamuni.alagu@sun.com-20100311191817-5nigmq884xo9fuut
Merge from mysql-6.0-codebase

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
set names binary;
 
2
#
 
3
# Start of 5.5 tests
 
4
#
 
5
#
 
6
# Start of WL#2649 Number-to-string conversions
 
7
#
 
8
select hex(concat(1));
 
9
hex(concat(1))
 
10
31
 
11
create table t1 as select concat(1) as c1;
 
12
show create table t1;
 
13
Table   Create Table
 
14
t1      CREATE TABLE `t1` (
 
15
  `c1` varbinary(1) NOT NULL DEFAULT ''
 
16
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
17
select hex(c1) from t1;
 
18
hex(c1)
 
19
31
 
20
drop table t1;
 
21
select hex(concat(18446744073709551615));
 
22
hex(concat(18446744073709551615))
 
23
3138343436373434303733373039353531363135
 
24
create table t1 as select concat(18446744073709551615) as c1;
 
25
show create table t1;
 
26
Table   Create Table
 
27
t1      CREATE TABLE `t1` (
 
28
  `c1` varbinary(20) NOT NULL DEFAULT ''
 
29
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
30
select hex(c1) from t1;
 
31
hex(c1)
 
32
3138343436373434303733373039353531363135
 
33
drop table t1;
 
34
select hex(concat(1.1));
 
35
hex(concat(1.1))
 
36
312E31
 
37
create table t1 as select concat(1.1) as c1;
 
38
show create table t1;
 
39
Table   Create Table
 
40
t1      CREATE TABLE `t1` (
 
41
  `c1` varbinary(4) NOT NULL DEFAULT ''
 
42
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
43
select hex(c1) from t1;
 
44
hex(c1)
 
45
312E31
 
46
drop table t1;
 
47
select hex(concat('a', 1+2)), charset(concat(1+2));
 
48
hex(concat('a', 1+2))   charset(concat(1+2))
 
49
6133    binary
 
50
create table t1 as select concat(1+2) as c1;
 
51
show create table t1;
 
52
Table   Create Table
 
53
t1      CREATE TABLE `t1` (
 
54
  `c1` varbinary(3) NOT NULL DEFAULT ''
 
55
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
56
drop table t1;
 
57
select hex(concat(1-2));
 
58
hex(concat(1-2))
 
59
2D31
 
60
create table t1 as select concat(1-2) as c1;
 
61
show create table t1;
 
62
Table   Create Table
 
63
t1      CREATE TABLE `t1` (
 
64
  `c1` varbinary(3) NOT NULL DEFAULT ''
 
65
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
66
drop table t1;
 
67
select hex(concat(1*2));
 
68
hex(concat(1*2))
 
69
32
 
70
create table t1 as select concat(1*2) as c1;
 
71
show create table t1;
 
72
Table   Create Table
 
73
t1      CREATE TABLE `t1` (
 
74
  `c1` varbinary(3) NOT NULL DEFAULT ''
 
75
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
76
drop table t1;
 
77
select hex(concat(1/2));
 
78
hex(concat(1/2))
 
79
302E35303030
 
80
create table t1 as select concat(1/2) as c1;
 
81
show create table t1;
 
82
Table   Create Table
 
83
t1      CREATE TABLE `t1` (
 
84
  `c1` varbinary(7) DEFAULT NULL
 
85
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
86
drop table t1;
 
87
select hex(concat(1 div 2));
 
88
hex(concat(1 div 2))
 
89
30
 
90
create table t1 as select concat(1 div 2) as c1;
 
91
show create table t1;
 
92
Table   Create Table
 
93
t1      CREATE TABLE `t1` (
 
94
  `c1` varbinary(1) DEFAULT NULL
 
95
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
96
drop table t1;
 
97
select hex(concat(1 % 2));
 
98
hex(concat(1 % 2))
 
99
31
 
100
create table t1 as select concat(1 % 2) as c1;
 
101
show create table t1;
 
102
Table   Create Table
 
103
t1      CREATE TABLE `t1` (
 
104
  `c1` varbinary(1) DEFAULT NULL
 
105
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
106
drop table t1;
 
107
select hex(concat(-1));
 
108
hex(concat(-1))
 
109
2D31
 
110
create table t1 as select concat(-1) as c1;
 
111
show create table t1;
 
112
Table   Create Table
 
113
t1      CREATE TABLE `t1` (
 
114
  `c1` varbinary(2) NOT NULL DEFAULT ''
 
115
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
116
drop table t1;
 
117
select hex(concat(-(1+2)));
 
118
hex(concat(-(1+2)))
 
119
2D33
 
120
create table t1 as select concat(-(1+2)) as c1;
 
121
show create table t1;
 
122
Table   Create Table
 
123
t1      CREATE TABLE `t1` (
 
124
  `c1` varbinary(4) NOT NULL DEFAULT ''
 
125
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
126
drop table t1;
 
127
select hex(concat(1|2));
 
128
hex(concat(1|2))
 
129
33
 
130
create table t1 as select concat(1|2) as c1;
 
131
show create table t1;
 
132
Table   Create Table
 
133
t1      CREATE TABLE `t1` (
 
134
  `c1` varbinary(21) NOT NULL DEFAULT ''
 
135
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
136
drop table t1;
 
137
select hex(concat(1&2));
 
138
hex(concat(1&2))
 
139
30
 
140
create table t1 as select concat(1&2) as c1;
 
141
show create table t1;
 
142
Table   Create Table
 
143
t1      CREATE TABLE `t1` (
 
144
  `c1` varbinary(21) NOT NULL DEFAULT ''
 
145
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
146
drop table t1;
 
147
select hex(concat(bit_count(12)));
 
148
hex(concat(bit_count(12)))
 
149
32
 
150
create table t1 as select concat(bit_count(12)) as c1;
 
151
show create table t1;
 
152
Table   Create Table
 
153
t1      CREATE TABLE `t1` (
 
154
  `c1` varbinary(2) NOT NULL DEFAULT ''
 
155
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
156
drop table t1;
 
157
select hex(concat(2<<1));
 
158
hex(concat(2<<1))
 
159
34
 
160
create table t1 as select concat(2<<1) as c1;
 
161
show create table t1;
 
162
Table   Create Table
 
163
t1      CREATE TABLE `t1` (
 
164
  `c1` varbinary(21) NOT NULL DEFAULT ''
 
165
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
166
drop table t1;
 
167
select hex(concat(2>>1));
 
168
hex(concat(2>>1))
 
169
31
 
170
create table t1 as select concat(2>>1) as c1;
 
171
show create table t1;
 
172
Table   Create Table
 
173
t1      CREATE TABLE `t1` (
 
174
  `c1` varbinary(21) NOT NULL DEFAULT ''
 
175
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
176
drop table t1;
 
177
select hex(concat(~0));
 
178
hex(concat(~0))
 
179
3138343436373434303733373039353531363135
 
180
create table t1 as select concat(~0) as c1;
 
181
show create table t1;
 
182
Table   Create Table
 
183
t1      CREATE TABLE `t1` (
 
184
  `c1` varbinary(21) NOT NULL DEFAULT ''
 
185
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
186
drop table t1;
 
187
select hex(concat(3^2));
 
188
hex(concat(3^2))
 
189
31
 
190
create table t1 as select concat(3^2) as c1;
 
191
show create table t1;
 
192
Table   Create Table
 
193
t1      CREATE TABLE `t1` (
 
194
  `c1` varbinary(21) NOT NULL DEFAULT ''
 
195
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
196
drop table t1;
 
197
select hex(concat(abs(-2)));
 
198
hex(concat(abs(-2)))
 
199
32
 
200
create table t1 as select concat(abs(-2)) as c1;
 
201
show create table t1;
 
202
Table   Create Table
 
203
t1      CREATE TABLE `t1` (
 
204
  `c1` varbinary(2) NOT NULL DEFAULT ''
 
205
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
206
drop table t1;
 
207
select hex(left(concat(exp(2)),1));
 
208
hex(left(concat(exp(2)),1))
 
209
37
 
210
create table t1 as select concat(exp(2)) as c1;
 
211
show create table t1;
 
212
Table   Create Table
 
213
t1      CREATE TABLE `t1` (
 
214
  `c1` varbinary(23) DEFAULT NULL
 
215
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
216
drop table t1;
 
217
select hex(left(concat(log(2)),1));
 
218
hex(left(concat(log(2)),1))
 
219
30
 
220
create table t1 as select concat(log(2)) as c1;
 
221
show create table t1;
 
222
Table   Create Table
 
223
t1      CREATE TABLE `t1` (
 
224
  `c1` varbinary(23) DEFAULT NULL
 
225
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
226
drop table t1;
 
227
select hex(left(concat(log2(2)),1));
 
228
hex(left(concat(log2(2)),1))
 
229
31
 
230
create table t1 as select concat(log2(2)) as c1;
 
231
show create table t1;
 
232
Table   Create Table
 
233
t1      CREATE TABLE `t1` (
 
234
  `c1` varbinary(23) DEFAULT NULL
 
235
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
236
drop table t1;
 
237
select hex(left(concat(log10(2)),1));
 
238
hex(left(concat(log10(2)),1))
 
239
30
 
240
create table t1 as select concat(log10(2)) as c1;
 
241
show create table t1;
 
242
Table   Create Table
 
243
t1      CREATE TABLE `t1` (
 
244
  `c1` varbinary(23) DEFAULT NULL
 
245
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
246
drop table t1;
 
247
select hex(left(concat(sqrt(2)),1));
 
248
hex(left(concat(sqrt(2)),1))
 
249
31
 
250
create table t1 as select concat(sqrt(2)) as c1;
 
251
show create table t1;
 
252
Table   Create Table
 
253
t1      CREATE TABLE `t1` (
 
254
  `c1` varbinary(23) DEFAULT NULL
 
255
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
256
drop table t1;
 
257
select hex(left(concat(pow(2,2)),1));
 
258
hex(left(concat(pow(2,2)),1))
 
259
34
 
260
create table t1 as select concat(pow(2,2)) as c1;
 
261
show create table t1;
 
262
Table   Create Table
 
263
t1      CREATE TABLE `t1` (
 
264
  `c1` varbinary(23) DEFAULT NULL
 
265
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
266
drop table t1;
 
267
select hex(left(concat(acos(0.5)),1));
 
268
hex(left(concat(acos(0.5)),1))
 
269
31
 
270
create table t1 as select concat(acos(0.5)) as c1;
 
271
show create table t1;
 
272
Table   Create Table
 
273
t1      CREATE TABLE `t1` (
 
274
  `c1` varbinary(23) DEFAULT NULL
 
275
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
276
drop table t1;
 
277
select hex(left(concat(asin(0.5)),1));
 
278
hex(left(concat(asin(0.5)),1))
 
279
30
 
280
create table t1 as select concat(asin(0.5)) as c1;
 
281
show create table t1;
 
282
Table   Create Table
 
283
t1      CREATE TABLE `t1` (
 
284
  `c1` varbinary(23) DEFAULT NULL
 
285
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
286
drop table t1;
 
287
select hex(left(concat(atan(0.5)),1));
 
288
hex(left(concat(atan(0.5)),1))
 
289
30
 
290
create table t1 as select concat(atan(0.5)) as c1;
 
291
show create table t1;
 
292
Table   Create Table
 
293
t1      CREATE TABLE `t1` (
 
294
  `c1` varbinary(23) DEFAULT NULL
 
295
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
296
drop table t1;
 
297
select hex(left(concat(cos(0.5)),1));
 
298
hex(left(concat(cos(0.5)),1))
 
299
30
 
300
create table t1 as select concat(cos(0.5)) as c1;
 
301
show create table t1;
 
302
Table   Create Table
 
303
t1      CREATE TABLE `t1` (
 
304
  `c1` varbinary(23) DEFAULT NULL
 
305
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
306
drop table t1;
 
307
select hex(left(concat(sin(0.5)),1));
 
308
hex(left(concat(sin(0.5)),1))
 
309
30
 
310
create table t1 as select concat(sin(0.5)) as c1;
 
311
show create table t1;
 
312
Table   Create Table
 
313
t1      CREATE TABLE `t1` (
 
314
  `c1` varbinary(23) DEFAULT NULL
 
315
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
316
drop table t1;
 
317
select hex(left(concat(tan(0.5)),1));
 
318
hex(left(concat(tan(0.5)),1))
 
319
30
 
320
create table t1 as select concat(tan(0.5)) as c1;
 
321
show create table t1;
 
322
Table   Create Table
 
323
t1      CREATE TABLE `t1` (
 
324
  `c1` varbinary(23) DEFAULT NULL
 
325
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
326
drop table t1;
 
327
select hex(concat(degrees(0)));
 
328
hex(concat(degrees(0)))
 
329
30
 
330
create table t1 as select concat(degrees(0)) as c1;
 
331
show create table t1;
 
332
Table   Create Table
 
333
t1      CREATE TABLE `t1` (
 
334
  `c1` varbinary(23) NOT NULL DEFAULT ''
 
335
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
336
drop table t1;
 
337
select hex(concat(radians(0)));
 
338
hex(concat(radians(0)))
 
339
30
 
340
create table t1 as select concat(radians(0)) as c1;
 
341
show create table t1;
 
342
Table   Create Table
 
343
t1      CREATE TABLE `t1` (
 
344
  `c1` varbinary(23) NOT NULL DEFAULT ''
 
345
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
346
drop table t1;
 
347
select hex(concat(ceiling(0.5)));
 
348
hex(concat(ceiling(0.5)))
 
349
31
 
350
create table t1 as select concat(ceiling(0.5)) as c1;
 
351
show create table t1;
 
352
Table   Create Table
 
353
t1      CREATE TABLE `t1` (
 
354
  `c1` varbinary(4) NOT NULL DEFAULT ''
 
355
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
356
drop table t1;
 
357
select hex(concat(floor(0.5)));
 
358
hex(concat(floor(0.5)))
 
359
30
 
360
create table t1 as select concat(floor(0.5)) as c1;
 
361
show create table t1;
 
362
Table   Create Table
 
363
t1      CREATE TABLE `t1` (
 
364
  `c1` varbinary(4) NOT NULL DEFAULT ''
 
365
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
366
drop table t1;
 
367
select hex(concat(round(0.5)));
 
368
hex(concat(round(0.5)))
 
369
31
 
370
create table t1 as select concat(round(0.5)) as c1;
 
371
show create table t1;
 
372
Table   Create Table
 
373
t1      CREATE TABLE `t1` (
 
374
  `c1` varbinary(3) NOT NULL DEFAULT ''
 
375
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
376
drop table t1;
 
377
select hex(concat(sign(0.5)));
 
378
hex(concat(sign(0.5)))
 
379
31
 
380
create table t1 as select concat(sign(0.5)) as c1;
 
381
show create table t1;
 
382
Table   Create Table
 
383
t1      CREATE TABLE `t1` (
 
384
  `c1` varbinary(21) NOT NULL DEFAULT ''
 
385
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
386
drop table t1;
 
387
create table t1 as select concat(rand()) as c1;
 
388
show create table t1;
 
389
Table   Create Table
 
390
t1      CREATE TABLE `t1` (
 
391
  `c1` varbinary(23) NOT NULL DEFAULT ''
 
392
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
393
drop table t1;
 
394
select hex(concat(length('a')));
 
395
hex(concat(length('a')))
 
396
31
 
397
create table t1 as select concat(length('a')) as c1;
 
398
show create table t1;
 
399
Table   Create Table
 
400
t1      CREATE TABLE `t1` (
 
401
  `c1` varbinary(10) NOT NULL DEFAULT ''
 
402
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
403
drop table t1;
 
404
select hex(concat(char_length('a')));
 
405
hex(concat(char_length('a')))
 
406
31
 
407
create table t1 as select concat(char_length('a')) as c1;
 
408
show create table t1;
 
409
Table   Create Table
 
410
t1      CREATE TABLE `t1` (
 
411
  `c1` varbinary(10) NOT NULL DEFAULT ''
 
412
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
413
drop table t1;
 
414
select hex(concat(bit_length('a')));
 
415
hex(concat(bit_length('a')))
 
416
38
 
417
create table t1 as select concat(bit_length('a')) as c1;
 
418
show create table t1;
 
419
Table   Create Table
 
420
t1      CREATE TABLE `t1` (
 
421
  `c1` varbinary(10) NOT NULL DEFAULT ''
 
422
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
423
drop table t1;
 
424
select hex(concat(coercibility('a')));
 
425
hex(concat(coercibility('a')))
 
426
34
 
427
create table t1 as select concat(coercibility('a')) as c1;
 
428
show create table t1;
 
429
Table   Create Table
 
430
t1      CREATE TABLE `t1` (
 
431
  `c1` varbinary(10) NOT NULL DEFAULT ''
 
432
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
433
drop table t1;
 
434
select hex(concat(locate('a','a')));
 
435
hex(concat(locate('a','a')))
 
436
31
 
437
create table t1 as select concat(locate('a','a')) as c1;
 
438
show create table t1;
 
439
Table   Create Table
 
440
t1      CREATE TABLE `t1` (
 
441
  `c1` varbinary(11) NOT NULL DEFAULT ''
 
442
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
443
drop table t1;
 
444
select hex(concat(field('c','a','b','c')));
 
445
hex(concat(field('c','a','b','c')))
 
446
33
 
447
create table t1 as select concat(field('c','a','b','c')) as c1;
 
448
show create table t1;
 
449
Table   Create Table
 
450
t1      CREATE TABLE `t1` (
 
451
  `c1` varbinary(3) NOT NULL DEFAULT ''
 
452
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
453
drop table t1;
 
454
select hex(concat(ascii(61)));
 
455
hex(concat(ascii(61)))
 
456
3534
 
457
create table t1 as select concat(ascii(61)) as c1;
 
458
show create table t1;
 
459
Table   Create Table
 
460
t1      CREATE TABLE `t1` (
 
461
  `c1` varbinary(3) NOT NULL DEFAULT ''
 
462
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
463
drop table t1;
 
464
select hex(concat(ord(61)));
 
465
hex(concat(ord(61)))
 
466
3534
 
467
create table t1 as select concat(ord(61)) as c1;
 
468
show create table t1;
 
469
Table   Create Table
 
470
t1      CREATE TABLE `t1` (
 
471
  `c1` varbinary(21) NOT NULL DEFAULT ''
 
472
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
473
drop table t1;
 
474
select hex(concat(find_in_set('b','a,b,c,d')));
 
475
hex(concat(find_in_set('b','a,b,c,d')))
 
476
32
 
477
create table t1 as select concat(find_in_set('b','a,b,c,d')) as c1;
 
478
show create table t1;
 
479
Table   Create Table
 
480
t1      CREATE TABLE `t1` (
 
481
  `c1` varbinary(3) NOT NULL DEFAULT ''
 
482
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
483
drop table t1;
 
484
select md5('a'), hex(md5('a'));
 
485
md5('a')        hex(md5('a'))
 
486
0cc175b9c0f1b6a831c399e269772661        3063633137356239633066316236613833316333393965323639373732363631
 
487
create table t1 as select md5('a') as c1;
 
488
show create table t1;
 
489
Table   Create Table
 
490
t1      CREATE TABLE `t1` (
 
491
  `c1` varbinary(32) NOT NULL DEFAULT ''
 
492
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
493
drop table t1;
 
494
select old_password('a'), hex(old_password('a'));
 
495
old_password('a')       hex(old_password('a'))
 
496
60671c896665c3fa        36303637316338393636363563336661
 
497
create table t1 as select old_password('a') as c1;
 
498
show create table t1;
 
499
Table   Create Table
 
500
t1      CREATE TABLE `t1` (
 
501
  `c1` varbinary(16) NOT NULL DEFAULT ''
 
502
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
503
drop table t1;
 
504
select password('a'), hex(password('a'));
 
505
password('a')   hex(password('a'))
 
506
*667F407DE7C6AD07358FA38DAED7828A72014B4E       2A36363746343037444537433641443037333538464133384441454437383238413732303134423445
 
507
create table t1 as select password('a') as c1;
 
508
show create table t1;
 
509
Table   Create Table
 
510
t1      CREATE TABLE `t1` (
 
511
  `c1` varbinary(41) NOT NULL DEFAULT ''
 
512
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
513
drop table t1;
 
514
select sha('a'), hex(sha('a'));
 
515
sha('a')        hex(sha('a'))
 
516
86f7e437faa5a7fce15d1ddcb9eaeaea377667b8        38366637653433376661613561376663653135643164646362396561656165613337373636376238
 
517
create table t1 as select sha('a') as c1;
 
518
show create table t1;
 
519
Table   Create Table
 
520
t1      CREATE TABLE `t1` (
 
521
  `c1` varbinary(40) NOT NULL DEFAULT ''
 
522
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
523
drop table t1;
 
524
select sha1('a'), hex(sha1('a'));
 
525
sha1('a')       hex(sha1('a'))
 
526
86f7e437faa5a7fce15d1ddcb9eaeaea377667b8        38366637653433376661613561376663653135643164646362396561656165613337373636376238
 
527
create table t1 as select sha1('a') as c1;
 
528
show create table t1;
 
529
Table   Create Table
 
530
t1      CREATE TABLE `t1` (
 
531
  `c1` varbinary(40) NOT NULL DEFAULT ''
 
532
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
533
drop table t1;
 
534
select hex(concat(cast('-1' as signed)));
 
535
hex(concat(cast('-1' as signed)))
 
536
2D31
 
537
create table t1 as select concat(cast('-1' as signed)) as c1;
 
538
show create table t1;
 
539
Table   Create Table
 
540
t1      CREATE TABLE `t1` (
 
541
  `c1` varbinary(2) NOT NULL DEFAULT ''
 
542
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
543
drop table t1;
 
544
select hex(concat(cast('1' as unsigned)));
 
545
hex(concat(cast('1' as unsigned)))
 
546
31
 
547
create table t1 as select concat(cast('1' as unsigned)) as c1;
 
548
show create table t1;
 
549
Table   Create Table
 
550
t1      CREATE TABLE `t1` (
 
551
  `c1` varbinary(1) NOT NULL DEFAULT ''
 
552
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
553
drop table t1;
 
554
select hex(concat(cast(1/2 as decimal(5,5))));
 
555
hex(concat(cast(1/2 as decimal(5,5))))
 
556
302E3530303030
 
557
create table t1 as select concat(cast(1/2 as decimal(5,5))) as c1;
 
558
show create table t1;
 
559
Table   Create Table
 
560
t1      CREATE TABLE `t1` (
 
561
  `c1` varbinary(7) DEFAULT NULL
 
562
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
563
drop table t1;
 
564
select hex(concat(cast('2001-01-02 03:04:05' as date)));
 
565
hex(concat(cast('2001-01-02 03:04:05' as date)))
 
566
323030312D30312D3032
 
567
create table t1 as select concat(cast('2001-01-02 03:04:05' as date)) as c1;
 
568
show create table t1;
 
569
Table   Create Table
 
570
t1      CREATE TABLE `t1` (
 
571
  `c1` varbinary(10) DEFAULT NULL
 
572
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
573
select * from t1;
 
574
c1
 
575
2001-01-02
 
576
drop table t1;
 
577
select hex(concat(cast('2001-01-02 03:04:05' as time)));
 
578
hex(concat(cast('2001-01-02 03:04:05' as time)))
 
579
30333A30343A3035
 
580
create table t1 as select concat(cast('2001-01-02 03:04:05' as time)) as c1;
 
581
show create table t1;
 
582
Table   Create Table
 
583
t1      CREATE TABLE `t1` (
 
584
  `c1` varbinary(19) DEFAULT NULL
 
585
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
586
select * from t1;
 
587
c1
 
588
03:04:05
 
589
drop table t1;
 
590
select hex(concat(cast('2001-01-02' as datetime)));
 
591
hex(concat(cast('2001-01-02' as datetime)))
 
592
323030312D30312D30322030303A30303A3030
 
593
create table t1 as select concat(cast('2001-01-02' as datetime)) as c1;
 
594
show create table t1;
 
595
Table   Create Table
 
596
t1      CREATE TABLE `t1` (
 
597
  `c1` varbinary(29) DEFAULT NULL
 
598
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
599
select * from t1;
 
600
c1
 
601
2001-01-02 00:00:00
 
602
drop table t1;
 
603
select hex(concat(least(1,2)));
 
604
hex(concat(least(1,2)))
 
605
31
 
606
create table t1 as select concat(least(1,2)) as c1;
 
607
show create table t1;
 
608
Table   Create Table
 
609
t1      CREATE TABLE `t1` (
 
610
  `c1` varbinary(2) NOT NULL DEFAULT ''
 
611
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
612
drop table t1;
 
613
select hex(concat(greatest(1,2)));
 
614
hex(concat(greatest(1,2)))
 
615
32
 
616
create table t1 as select concat(greatest(1,2)) as c1;
 
617
show create table t1;
 
618
Table   Create Table
 
619
t1      CREATE TABLE `t1` (
 
620
  `c1` varbinary(2) NOT NULL DEFAULT ''
 
621
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
622
drop table t1;
 
623
select hex(concat(case when 11 then 22 else 33 end));
 
624
hex(concat(case when 11 then 22 else 33 end))
 
625
3232
 
626
create table t1 as select concat(case when 11 then 22 else 33 end) as c1;
 
627
show create table t1;
 
628
Table   Create Table
 
629
t1      CREATE TABLE `t1` (
 
630
  `c1` varbinary(2) NOT NULL DEFAULT ''
 
631
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
632
drop table t1;
 
633
select hex(concat(coalesce(1,2)));
 
634
hex(concat(coalesce(1,2)))
 
635
31
 
636
create table t1 as select concat(coalesce(1,2)) as c1;
 
637
show create table t1;
 
638
Table   Create Table
 
639
t1      CREATE TABLE `t1` (
 
640
  `c1` varbinary(1) NOT NULL DEFAULT ''
 
641
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
642
drop table t1;
 
643
select hex(concat_ws(1,2,3));
 
644
hex(concat_ws(1,2,3))
 
645
323133
 
646
create table t1 as select concat_ws(1,2,3) as c1;
 
647
show create table t1;
 
648
Table   Create Table
 
649
t1      CREATE TABLE `t1` (
 
650
  `c1` varbinary(3) NOT NULL DEFAULT ''
 
651
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
652
drop table t1;
 
653
select hex(group_concat(1,2,3));
 
654
hex(group_concat(1,2,3))
 
655
313233
 
656
create table t1 as select group_concat(1,2,3) as c1;
 
657
show create table t1;
 
658
Table   Create Table
 
659
t1      CREATE TABLE `t1` (
 
660
  `c1` blob
 
661
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
662
drop table t1;
 
663
create table t1 as select 1 as c1 union select 'a';
 
664
show create table t1;
 
665
Table   Create Table
 
666
t1      CREATE TABLE `t1` (
 
667
  `c1` varbinary(1) NOT NULL DEFAULT ''
 
668
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
669
select hex(c1) from t1 order by c1;
 
670
hex(c1)
 
671
31
 
672
61
 
673
drop table t1;
 
674
create table t1 as select concat(last_insert_id()) as c1;
 
675
show create table t1;
 
676
Table   Create Table
 
677
t1      CREATE TABLE `t1` (
 
678
  `c1` varbinary(21) NOT NULL DEFAULT ''
 
679
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
680
drop table t1;
 
681
select hex(concat(benchmark(0,0)));
 
682
hex(concat(benchmark(0,0)))
 
683
30
 
684
create table t1 as select concat(benchmark(0,0)) as c1;
 
685
show create table t1;
 
686
Table   Create Table
 
687
t1      CREATE TABLE `t1` (
 
688
  `c1` varbinary(1) NOT NULL DEFAULT ''
 
689
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
690
drop table t1;
 
691
select hex(concat(sleep(0)));
 
692
hex(concat(sleep(0)))
 
693
30
 
694
create table t1 as select concat(sleep(0)) as c1;
 
695
show create table t1;
 
696
Table   Create Table
 
697
t1      CREATE TABLE `t1` (
 
698
  `c1` varbinary(21) NOT NULL DEFAULT ''
 
699
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
700
drop table t1;
 
701
select hex(concat(is_free_lock('xxxx')));
 
702
hex(concat(is_free_lock('xxxx')))
 
703
31
 
704
create table t1 as select concat(is_free_lock('xxxx')) as c1;
 
705
show create table t1;
 
706
Table   Create Table
 
707
t1      CREATE TABLE `t1` (
 
708
  `c1` varbinary(1) DEFAULT NULL
 
709
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
710
drop table t1;
 
711
create table t1 as select concat(is_used_lock('a')) as c1;
 
712
show create table t1;
 
713
Table   Create Table
 
714
t1      CREATE TABLE `t1` (
 
715
  `c1` varbinary(10) DEFAULT NULL
 
716
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
717
drop table t1;
 
718
create table t1 as select concat(release_lock('a')) as c1;
 
719
show create table t1;
 
720
Table   Create Table
 
721
t1      CREATE TABLE `t1` (
 
722
  `c1` varbinary(1) DEFAULT NULL
 
723
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
724
drop table t1;
 
725
select hex(concat(crc32('')));
 
726
hex(concat(crc32('')))
 
727
30
 
728
create table t1 as select concat(crc32('')) as c1;
 
729
show create table t1;
 
730
Table   Create Table
 
731
t1      CREATE TABLE `t1` (
 
732
  `c1` varbinary(10) NOT NULL DEFAULT ''
 
733
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
734
drop table t1;
 
735
select hex(concat(uncompressed_length('')));
 
736
hex(concat(uncompressed_length('')))
 
737
30
 
738
create table t1 as select concat(uncompressed_length('')) as c1;
 
739
show create table t1;
 
740
Table   Create Table
 
741
t1      CREATE TABLE `t1` (
 
742
  `c1` varbinary(10) NOT NULL DEFAULT ''
 
743
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
744
drop table t1;
 
745
create table t1 as select concat(connection_id()) as c1;
 
746
show create table t1;
 
747
Table   Create Table
 
748
t1      CREATE TABLE `t1` (
 
749
  `c1` varbinary(10) NOT NULL DEFAULT ''
 
750
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
751
drop table t1;
 
752
select hex(concat(inet_aton('127.1.1.1')));
 
753
hex(concat(inet_aton('127.1.1.1')))
 
754
32313330373732323235
 
755
create table t1 as select concat(inet_aton('127.1.1.1')) as c1;
 
756
show create table t1;
 
757
Table   Create Table
 
758
t1      CREATE TABLE `t1` (
 
759
  `c1` varbinary(21) DEFAULT NULL
 
760
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
761
drop table t1;
 
762
select hex(concat(inet_ntoa(2130772225)));
 
763
hex(concat(inet_ntoa(2130772225)))
 
764
3132372E312E312E31
 
765
create table t1 as select concat(inet_ntoa(2130772225)) as c1;
 
766
select * from t1;
 
767
c1
 
768
127.1.1.1
 
769
show create table t1;
 
770
Table   Create Table
 
771
t1      CREATE TABLE `t1` (
 
772
  `c1` varbinary(31) DEFAULT NULL
 
773
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
774
drop table t1;
 
775
select hex(concat(row_count()));
 
776
hex(concat(row_count()))
 
777
2D31
 
778
create table t1 as select concat(row_count()) as c1;
 
779
show create table t1;
 
780
Table   Create Table
 
781
t1      CREATE TABLE `t1` (
 
782
  `c1` varbinary(21) NOT NULL DEFAULT ''
 
783
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
784
drop table t1;
 
785
select hex(concat(found_rows()));
 
786
hex(concat(found_rows()))
 
787
30
 
788
create table t1 as select concat(found_rows()) as c1;
 
789
show create table t1;
 
790
Table   Create Table
 
791
t1      CREATE TABLE `t1` (
 
792
  `c1` varbinary(21) NOT NULL DEFAULT ''
 
793
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
794
drop table t1;
 
795
create table t1 as select concat(uuid_short()) as c1;
 
796
show create table t1;
 
797
Table   Create Table
 
798
t1      CREATE TABLE `t1` (
 
799
  `c1` varbinary(21) NOT NULL DEFAULT ''
 
800
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
801
drop table t1;
 
802
create table t1 as select concat(uuid()) as c1;
 
803
show create table t1;
 
804
Table   Create Table
 
805
t1      CREATE TABLE `t1` (
 
806
  `c1` varchar(36) CHARACTER SET utf8 NOT NULL DEFAULT ''
 
807
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
808
drop table t1;
 
809
select coercibility(uuid()), coercibility(cast('a' as char character set latin1));
 
810
coercibility(uuid())    coercibility(cast('a' as char character set latin1))
 
811
4       2
 
812
select charset(concat(uuid(), cast('a' as char character set latin1)));
 
813
charset(concat(uuid(), cast('a' as char character set latin1)))
 
814
latin1
 
815
create table t1 as select concat(uuid(), cast('a' as char character set latin1)) as c1;
 
816
show create table t1;
 
817
Table   Create Table
 
818
t1      CREATE TABLE `t1` (
 
819
  `c1` varchar(37) NOT NULL DEFAULT ''
 
820
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
821
drop table t1;
 
822
create table t1 as select concat(master_pos_wait('non-existent',0,2)) as c1;
 
823
show create table t1;
 
824
Table   Create Table
 
825
t1      CREATE TABLE `t1` (
 
826
  `c1` varbinary(21) DEFAULT NULL
 
827
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
828
drop table t1;
 
829
select hex(concat(@a1:=1));
 
830
hex(concat(@a1:=1))
 
831
31
 
832
create table t1 as select concat(@a2:=2) as c1, @a3:=3 as c2;
 
833
select hex(c1) from t1;
 
834
hex(c1)
 
835
32
 
836
show create table t1;
 
837
Table   Create Table
 
838
t1      CREATE TABLE `t1` (
 
839
  `c1` varbinary(1) NOT NULL DEFAULT '',
 
840
  `c2` int(1) NOT NULL DEFAULT '0'
 
841
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
842
drop table t1;
 
843
set @a2=1;
 
844
select hex(concat(@a2));
 
845
hex(concat(@a2))
 
846
31
 
847
create table t1 as select concat(@a2) as c1, @a2 as c2;
 
848
select hex(c1) from t1;
 
849
hex(c1)
 
850
31
 
851
show create table t1;
 
852
Table   Create Table
 
853
t1      CREATE TABLE `t1` (
 
854
  `c1` varbinary(20) DEFAULT NULL,
 
855
  `c2` bigint(20) DEFAULT NULL
 
856
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
857
drop table t1;
 
858
select hex(concat(@a1:=sqrt(1)));
 
859
hex(concat(@a1:=sqrt(1)))
 
860
31
 
861
create table t1 as select concat(@a2:=sqrt(1)) as c1, @a3:=sqrt(1) as c2;
 
862
select hex(c1) from t1;
 
863
hex(c1)
 
864
31
 
865
show create table t1;
 
866
Table   Create Table
 
867
t1      CREATE TABLE `t1` (
 
868
  `c1` varbinary(23) DEFAULT NULL,
 
869
  `c2` double DEFAULT NULL
 
870
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
871
drop table t1;
 
872
set @a2=sqrt(1);
 
873
select hex(concat(@a2));
 
874
hex(concat(@a2))
 
875
31
 
876
create table t1 as select concat(@a2) as c1, @a2 as c2;
 
877
select hex(c1) from t1;
 
878
hex(c1)
 
879
31
 
880
show create table t1;
 
881
Table   Create Table
 
882
t1      CREATE TABLE `t1` (
 
883
  `c1` varbinary(23) DEFAULT NULL,
 
884
  `c2` double DEFAULT NULL
 
885
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
886
drop table t1;
 
887
select hex(concat(@a1:=1.1));
 
888
hex(concat(@a1:=1.1))
 
889
312E31
 
890
create table t1 as select concat(@a2:=1.1) as c1, @a3:=1.1 as c2;
 
891
select hex(c1) from t1;
 
892
hex(c1)
 
893
312E31
 
894
show create table t1;
 
895
Table   Create Table
 
896
t1      CREATE TABLE `t1` (
 
897
  `c1` varbinary(4) NOT NULL DEFAULT '',
 
898
  `c2` decimal(2,1) NOT NULL DEFAULT '0.0'
 
899
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
900
drop table t1;
 
901
set @a2=1.1;
 
902
select hex(concat(@a2));
 
903
hex(concat(@a2))
 
904
312E31
 
905
create table t1 as select concat(@a2) as c1, @a2 as c2;
 
906
select hex(c1) from t1;
 
907
hex(c1)
 
908
312E31
 
909
show create table t1;
 
910
Table   Create Table
 
911
t1      CREATE TABLE `t1` (
 
912
  `c1` varbinary(83) DEFAULT NULL,
 
913
  `c2` decimal(65,30) DEFAULT NULL
 
914
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
915
drop table t1;
 
916
select hex(concat(@@ft_max_word_len));
 
917
hex(concat(@@ft_max_word_len))
 
918
3834
 
919
create table t1 as select concat(@@ft_max_word_len) as c1;
 
920
select hex(c1) from t1;
 
921
hex(c1)
 
922
3834
 
923
show create table t1;
 
924
Table   Create Table
 
925
t1      CREATE TABLE `t1` (
 
926
  `c1` varbinary(21) DEFAULT NULL
 
927
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
928
drop table t1;
 
929
select hex(concat('a'='a' IS TRUE));
 
930
hex(concat('a'='a' IS TRUE))
 
931
31
 
932
create table t1 as select concat('a'='a' IS TRUE) as c1;
 
933
show create table t1;
 
934
Table   Create Table
 
935
t1      CREATE TABLE `t1` (
 
936
  `c1` varbinary(1) NOT NULL DEFAULT ''
 
937
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
938
drop table t1;
 
939
select hex(concat('a'='a' IS NOT TRUE));
 
940
hex(concat('a'='a' IS NOT TRUE))
 
941
30
 
942
create table t1 as select concat('a'='a' IS NOT TRUE) as c1;
 
943
show create table t1;
 
944
Table   Create Table
 
945
t1      CREATE TABLE `t1` (
 
946
  `c1` varbinary(1) NOT NULL DEFAULT ''
 
947
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
948
drop table t1;
 
949
select hex(concat(NOT 'a'='a'));
 
950
hex(concat(NOT 'a'='a'))
 
951
30
 
952
create table t1 as select concat(NOT 'a'='a') as c1;
 
953
show create table t1;
 
954
Table   Create Table
 
955
t1      CREATE TABLE `t1` (
 
956
  `c1` varbinary(1) NOT NULL DEFAULT ''
 
957
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
958
drop table t1;
 
959
select hex(concat('a' IS NULL));
 
960
hex(concat('a' IS NULL))
 
961
30
 
962
create table t1 as select concat('a' IS NULL) as c1;
 
963
show create table t1;
 
964
Table   Create Table
 
965
t1      CREATE TABLE `t1` (
 
966
  `c1` varbinary(1) NOT NULL DEFAULT ''
 
967
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
968
drop table t1;
 
969
select hex(concat('a' IS NOT NULL));
 
970
hex(concat('a' IS NOT NULL))
 
971
31
 
972
create table t1 as select concat('a' IS NOT NULL) as c1;
 
973
show create table t1;
 
974
Table   Create Table
 
975
t1      CREATE TABLE `t1` (
 
976
  `c1` varbinary(1) NOT NULL DEFAULT ''
 
977
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
978
drop table t1;
 
979
select hex(concat('a' rlike 'a'));
 
980
hex(concat('a' rlike 'a'))
 
981
31
 
982
create table t1 as select concat('a' IS NOT NULL) as c1;
 
983
show create table t1;
 
984
Table   Create Table
 
985
t1      CREATE TABLE `t1` (
 
986
  `c1` varbinary(1) NOT NULL DEFAULT ''
 
987
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
988
drop table t1;
 
989
select hex(concat(strcmp('a','b')));
 
990
hex(concat(strcmp('a','b')))
 
991
2D31
 
992
create table t1 as select concat(strcmp('a','b')) as c1;
 
993
show create table t1;
 
994
Table   Create Table
 
995
t1      CREATE TABLE `t1` (
 
996
  `c1` varbinary(2) NOT NULL DEFAULT ''
 
997
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
998
drop table t1;
 
999
select hex(concat('a' like 'a'));
 
1000
hex(concat('a' like 'a'))
 
1001
31
 
1002
create table t1 as select concat('a' like 'b') as c1;
 
1003
show create table t1;
 
1004
Table   Create Table
 
1005
t1      CREATE TABLE `t1` (
 
1006
  `c1` varbinary(1) NOT NULL DEFAULT ''
 
1007
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
1008
drop table t1;
 
1009
select hex(concat('a' between 'b' and 'c'));
 
1010
hex(concat('a' between 'b' and 'c'))
 
1011
30
 
1012
create table t1 as select concat('a' between 'b' and 'c') as c1;
 
1013
show create table t1;
 
1014
Table   Create Table
 
1015
t1      CREATE TABLE `t1` (
 
1016
  `c1` varbinary(1) NOT NULL DEFAULT ''
 
1017
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
1018
drop table t1;
 
1019
select hex(concat('a' in ('a','b')));
 
1020
hex(concat('a' in ('a','b')))
 
1021
31
 
1022
create table t1 as select concat('a' in ('a','b')) as c1;
 
1023
show create table t1;
 
1024
Table   Create Table
 
1025
t1      CREATE TABLE `t1` (
 
1026
  `c1` varbinary(1) NOT NULL DEFAULT ''
 
1027
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
1028
drop table t1;
 
1029
select hex(concat(interval(23, 1, 15, 17, 30, 44, 200)));
 
1030
hex(concat(interval(23, 1, 15, 17, 30, 44, 200)))
 
1031
33
 
1032
create table t1 as select concat(interval(23, 1, 15, 17, 30, 44, 200)) as c1;
 
1033
show create table t1;
 
1034
Table   Create Table
 
1035
t1      CREATE TABLE `t1` (
 
1036
  `c1` varbinary(2) NOT NULL DEFAULT ''
 
1037
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
1038
drop table t1;
 
1039
create table t1 (a varchar(10), fulltext key(a));
 
1040
insert into t1 values ('a');
 
1041
select hex(concat(match (a) against ('a'))) from t1;
 
1042
hex(concat(match (a) against ('a')))
 
1043
30
 
1044
create table t2 as select concat(match (a) against ('a')) as a from t1;
 
1045
show create table t2;
 
1046
Table   Create Table
 
1047
t2      CREATE TABLE `t2` (
 
1048
  `a` varbinary(23) DEFAULT NULL
 
1049
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
1050
drop table t1, t2;
 
1051
select hex(ifnull(1,'a'));
 
1052
hex(ifnull(1,'a'))
 
1053
31
 
1054
create table t1 as select ifnull(1,'a') as c1;
 
1055
show create table t1;
 
1056
Table   Create Table
 
1057
t1      CREATE TABLE `t1` (
 
1058
  `c1` varbinary(1) NOT NULL DEFAULT ''
 
1059
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
1060
drop table t1;
 
1061
select hex(concat(ifnull(1,1)));
 
1062
hex(concat(ifnull(1,1)))
 
1063
31
 
1064
create table t1 as select concat(ifnull(1,1)) as c1;
 
1065
show create table t1;
 
1066
Table   Create Table
 
1067
t1      CREATE TABLE `t1` (
 
1068
  `c1` varbinary(1) NOT NULL DEFAULT ''
 
1069
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
1070
drop table t1;
 
1071
select hex(concat(ifnull(1.1,1.1)));
 
1072
hex(concat(ifnull(1.1,1.1)))
 
1073
312E31
 
1074
create table t1 as select concat(ifnull(1.1,1.1)) as c1;
 
1075
show create table t1;
 
1076
Table   Create Table
 
1077
t1      CREATE TABLE `t1` (
 
1078
  `c1` varbinary(4) NOT NULL DEFAULT ''
 
1079
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
1080
drop table t1;
 
1081
select hex(if(1,'b',1));
 
1082
hex(if(1,'b',1))
 
1083
62
 
1084
create table t1 as select if(1,'b',1) as c1;
 
1085
show create table t1;
 
1086
Table   Create Table
 
1087
t1      CREATE TABLE `t1` (
 
1088
  `c1` varbinary(1) NOT NULL DEFAULT ''
 
1089
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
1090
drop table t1;
 
1091
select hex(if(1,1,'b'));
 
1092
hex(if(1,1,'b'))
 
1093
31
 
1094
create table t1 as select if(1,1,'b') as c1;
 
1095
show create table t1;
 
1096
Table   Create Table
 
1097
t1      CREATE TABLE `t1` (
 
1098
  `c1` varbinary(1) NOT NULL DEFAULT ''
 
1099
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
1100
drop table t1;
 
1101
select hex(concat(if(1,1,1)));
 
1102
hex(concat(if(1,1,1)))
 
1103
31
 
1104
create table t1 as select concat(if(1,1,1)) as c1;
 
1105
show create table t1;
 
1106
Table   Create Table
 
1107
t1      CREATE TABLE `t1` (
 
1108
  `c1` varbinary(1) NOT NULL DEFAULT ''
 
1109
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
1110
drop table t1;
 
1111
select hex(concat(nullif(1,2)));
 
1112
hex(concat(nullif(1,2)))
 
1113
31
 
1114
create table t1 as select concat(nullif(1,2)) as c1;
 
1115
show create table t1;
 
1116
Table   Create Table
 
1117
t1      CREATE TABLE `t1` (
 
1118
  `c1` varbinary(1) DEFAULT NULL
 
1119
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
1120
drop table t1;
 
1121
select hex(concat(Dimension(GeomFromText('LINESTRING(0 0,10 10)'))));
 
1122
hex(concat(Dimension(GeomFromText('LINESTRING(0 0,10 10)'))))
 
1123
31
 
1124
create table t1 as select concat(Dimension(GeomFromText('LINSTRING(0 0,10 10)'))) as c1;
 
1125
show create table t1;
 
1126
Table   Create Table
 
1127
t1      CREATE TABLE `t1` (
 
1128
  `c1` varbinary(10) DEFAULT NULL
 
1129
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
1130
drop table t1;
 
1131
select hex(concat(NumGeometries(MultiPointFromText('MULTIPOINT(0 0,10 10)'))));
 
1132
hex(concat(NumGeometries(MultiPointFromText('MULTIPOINT(0 0,10 10)'))))
 
1133
32
 
1134
create table t1 as select concat(NumGeometries(MultiPointFromText('MULTIPOINT(0 0,10 10)'))) as c1;
 
1135
show create table t1;
 
1136
Table   Create Table
 
1137
t1      CREATE TABLE `t1` (
 
1138
  `c1` varbinary(10) DEFAULT NULL
 
1139
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
1140
drop table t1;
 
1141
select hex(concat(NumPoints(MultiPointFromText('LINESTRING(0 0,10 10)'))));
 
1142
hex(concat(NumPoints(MultiPointFromText('LINESTRING(0 0,10 10)'))))
 
1143
32
 
1144
create table t1 as select concat(NumPoints(MultiPointFromText('LINESTRING(0 0,10 10)'))) as c1;
 
1145
show create table t1;
 
1146
Table   Create Table
 
1147
t1      CREATE TABLE `t1` (
 
1148
  `c1` varbinary(10) DEFAULT NULL
 
1149
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
1150
drop table t1;
 
1151
select hex(concat(SRID(MultiPointFromText('MULTIPOINT(0 0,10 10)'))));
 
1152
hex(concat(SRID(MultiPointFromText('MULTIPOINT(0 0,10 10)'))))
 
1153
30
 
1154
create table t1 as select concat(SRID(MultiPointFromText('MULTIPOINT(0 0,10 10)'))) as c1;
 
1155
show create table t1;
 
1156
Table   Create Table
 
1157
t1      CREATE TABLE `t1` (
 
1158
  `c1` varbinary(10) DEFAULT NULL
 
1159
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
1160
drop table t1;
 
1161
select hex(concat(NumInteriorRings(PolygonFromText('POLYGON((0 0,50 0,50 50,0 50,0 0), (10 10,20 10,20 20,10 20,10 10))'))));
 
1162
hex(concat(NumInteriorRings(PolygonFromText('POLYGON((0 0,50 0,50 50,0 50,0 0), (10 10,20 10,20 20,10 20,10 10))'))))
 
1163
31
 
1164
create table t1 as select concat(NumInteriorRings(PolygonFromText('POLYGON((0 0,50 0,50 50,0 50,0 0), (10 10,20 10,20 20,10 20,10 10))'))) as c1;
 
1165
show create table t1;
 
1166
Table   Create Table
 
1167
t1      CREATE TABLE `t1` (
 
1168
  `c1` varbinary(10) DEFAULT NULL
 
1169
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
1170
drop table t1;
 
1171
select hex(concat(IsEmpty(GeomFromText('POINT(1 1)'))));
 
1172
hex(concat(IsEmpty(GeomFromText('POINT(1 1)'))))
 
1173
30
 
1174
create table t1 as select concat(IsEmpty(GeomFromText('Point(1 1)'))) as c1;
 
1175
show create table t1;
 
1176
Table   Create Table
 
1177
t1      CREATE TABLE `t1` (
 
1178
  `c1` varbinary(21) DEFAULT NULL
 
1179
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
1180
drop table t1;
 
1181
select hex(concat(IsSimple(GeomFromText('POINT(1 1)'))));
 
1182
hex(concat(IsSimple(GeomFromText('POINT(1 1)'))))
 
1183
30
 
1184
create table t1 as select concat(IsSimple(GeomFromText('Point(1 1)'))) as c1;
 
1185
show create table t1;
 
1186
Table   Create Table
 
1187
t1      CREATE TABLE `t1` (
 
1188
  `c1` varbinary(21) DEFAULT NULL
 
1189
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
1190
drop table t1;
 
1191
select hex(concat(IsClosed(GeomFromText('LineString(1 1,2 2)'))));
 
1192
hex(concat(IsClosed(GeomFromText('LineString(1 1,2 2)'))))
 
1193
30
 
1194
create table t1 as select concat(IsClosed(GeomFromText('LineString(1 1,2 2)'))) as c1;
 
1195
show create table t1;
 
1196
Table   Create Table
 
1197
t1      CREATE TABLE `t1` (
 
1198
  `c1` varbinary(21) DEFAULT NULL
 
1199
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
1200
drop table t1;
 
1201
select hex(concat(Equals(GeomFromText('Point(1 1)'),GeomFromText('Point(1 1)'))));
 
1202
hex(concat(Equals(GeomFromText('Point(1 1)'),GeomFromText('Point(1 1)'))))
 
1203
31
 
1204
create table t1 as select concat(Equals(GeomFromText('Point(1 1)'),GeomFromText('Point(1 1)'))) as c1;
 
1205
drop table t1;
 
1206
select hex(concat(x(GeomFromText('Point(1 2)'))));
 
1207
hex(concat(x(GeomFromText('Point(1 2)'))))
 
1208
31
 
1209
create table t1 as select concat(x(GeomFromText('Point(1 2)'))) as c1;
 
1210
show create table t1;
 
1211
Table   Create Table
 
1212
t1      CREATE TABLE `t1` (
 
1213
  `c1` varbinary(23) DEFAULT NULL
 
1214
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
1215
drop table t1;
 
1216
select hex(concat(y(GeomFromText('Point(1 2)'))));
 
1217
hex(concat(y(GeomFromText('Point(1 2)'))))
 
1218
32
 
1219
create table t1 as select concat(x(GeomFromText('Point(1 2)'))) as c1;
 
1220
show create table t1;
 
1221
Table   Create Table
 
1222
t1      CREATE TABLE `t1` (
 
1223
  `c1` varbinary(23) DEFAULT NULL
 
1224
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
1225
drop table t1;
 
1226
select hex(concat(GLength(GeomFromText('LineString(1 2,2 2)'))));
 
1227
hex(concat(GLength(GeomFromText('LineString(1 2,2 2)'))))
 
1228
31
 
1229
create table t1 as select concat(GLength(GeomFromText('LineString(1 2, 2 2)'))) as c1;
 
1230
show create table t1;
 
1231
Table   Create Table
 
1232
t1      CREATE TABLE `t1` (
 
1233
  `c1` varbinary(23) DEFAULT NULL
 
1234
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
1235
drop table t1;
 
1236
select hex(concat(Area(GeomFromText('Polygon((0 0,1 0,1 1,0 1,0 0))'))));
 
1237
hex(concat(Area(GeomFromText('Polygon((0 0,1 0,1 1,0 1,0 0))'))))
 
1238
31
 
1239
create table t1 as select concat(Area(GeomFromText('Polygon((0 0,1 0,1 1,0 1,0 0))'))) as c1;
 
1240
show create table t1;
 
1241
Table   Create Table
 
1242
t1      CREATE TABLE `t1` (
 
1243
  `c1` varbinary(23) DEFAULT NULL
 
1244
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
1245
drop table t1;
 
1246
select hex(concat(GeometryType(GeomFromText('Point(1 2)'))));
 
1247
hex(concat(GeometryType(GeomFromText('Point(1 2)'))))
 
1248
504F494E54
 
1249
create table t1 as select concat(GeometryType(GeomFromText('Point(1 2)'))) as c1;
 
1250
show create table t1;
 
1251
Table   Create Table
 
1252
t1      CREATE TABLE `t1` (
 
1253
  `c1` varbinary(20) DEFAULT NULL
 
1254
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
1255
drop table t1;
 
1256
select hex(concat(AsText(GeomFromText('Point(1 2)'))));
 
1257
hex(concat(AsText(GeomFromText('Point(1 2)'))))
 
1258
504F494E542831203229
 
1259
create table t1 as select concat(AsText(GeomFromText('Point(1 2)'))) as c1;
 
1260
show create table t1;
 
1261
Table   Create Table
 
1262
t1      CREATE TABLE `t1` (
 
1263
  `c1` longblob
 
1264
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
1265
drop table t1;
 
1266
select hex(concat(period_add(200902, 2)));
 
1267
hex(concat(period_add(200902, 2)))
 
1268
323030393034
 
1269
create table t1 as select concat(period_add(200902, 2)) as c1;
 
1270
show create table t1;
 
1271
Table   Create Table
 
1272
t1      CREATE TABLE `t1` (
 
1273
  `c1` varbinary(6) NOT NULL DEFAULT ''
 
1274
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
1275
drop table t1;
 
1276
select hex(concat(period_diff(200902, 200802)));
 
1277
hex(concat(period_diff(200902, 200802)))
 
1278
3132
 
1279
create table t1 as select concat(period_add(200902, 200802)) as c1;
 
1280
Warnings:
 
1281
Warning 1265    Data truncated for column 'c1' at row 1
 
1282
show create table t1;
 
1283
Table   Create Table
 
1284
t1      CREATE TABLE `t1` (
 
1285
  `c1` varbinary(6) NOT NULL DEFAULT ''
 
1286
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
1287
drop table t1;
 
1288
select hex(concat(to_days(20090224)));
 
1289
hex(concat(to_days(20090224)))
 
1290
373333383237
 
1291
create table t1 as select concat(to_days(20090224)) as c1;
 
1292
show create table t1;
 
1293
Table   Create Table
 
1294
t1      CREATE TABLE `t1` (
 
1295
  `c1` varbinary(6) DEFAULT NULL
 
1296
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
1297
drop table t1;
 
1298
select hex(concat(dayofmonth(20090224)));
 
1299
hex(concat(dayofmonth(20090224)))
 
1300
3234
 
1301
create table t1 as select concat(dayofmonth(20090224)) as c1;
 
1302
show create table t1;
 
1303
Table   Create Table
 
1304
t1      CREATE TABLE `t1` (
 
1305
  `c1` varbinary(2) DEFAULT NULL
 
1306
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
1307
drop table t1;
 
1308
select hex(concat(dayofyear(20090224)));
 
1309
hex(concat(dayofyear(20090224)))
 
1310
3535
 
1311
create table t1 as select concat(dayofyear(20090224)) as c1;
 
1312
show create table t1;
 
1313
Table   Create Table
 
1314
t1      CREATE TABLE `t1` (
 
1315
  `c1` varbinary(3) DEFAULT NULL
 
1316
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
1317
drop table t1;
 
1318
select hex(concat(hour('10:11:12')));
 
1319
hex(concat(hour('10:11:12')))
 
1320
3130
 
1321
create table t1 as select concat(hour('10:11:12')) as c1;
 
1322
show create table t1;
 
1323
Table   Create Table
 
1324
t1      CREATE TABLE `t1` (
 
1325
  `c1` varbinary(2) DEFAULT NULL
 
1326
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
1327
drop table t1;
 
1328
select hex(concat(minute('10:11:12')));
 
1329
hex(concat(minute('10:11:12')))
 
1330
3131
 
1331
create table t1 as select concat(minute('10:11:12')) as c1;
 
1332
show create table t1;
 
1333
Table   Create Table
 
1334
t1      CREATE TABLE `t1` (
 
1335
  `c1` varbinary(2) DEFAULT NULL
 
1336
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
1337
drop table t1;
 
1338
select hex(concat(second('10:11:12')));
 
1339
hex(concat(second('10:11:12')))
 
1340
3132
 
1341
create table t1 as select concat(second('10:11:12')) as c1;
 
1342
show create table t1;
 
1343
Table   Create Table
 
1344
t1      CREATE TABLE `t1` (
 
1345
  `c1` varbinary(2) DEFAULT NULL
 
1346
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
1347
drop table t1;
 
1348
select hex(concat(quarter(20090224)));
 
1349
hex(concat(quarter(20090224)))
 
1350
31
 
1351
create table t1 as select concat(quarter(20090224)) as c1;
 
1352
show create table t1;
 
1353
Table   Create Table
 
1354
t1      CREATE TABLE `t1` (
 
1355
  `c1` varbinary(1) DEFAULT NULL
 
1356
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
1357
drop table t1;
 
1358
select hex(concat(week(20090224)));
 
1359
hex(concat(week(20090224)))
 
1360
38
 
1361
create table t1 as select concat(week(20090224)) as c1;
 
1362
show create table t1;
 
1363
Table   Create Table
 
1364
t1      CREATE TABLE `t1` (
 
1365
  `c1` varbinary(2) DEFAULT NULL
 
1366
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
1367
drop table t1;
 
1368
select hex(concat(yearweek(20090224)));
 
1369
hex(concat(yearweek(20090224)))
 
1370
323030393038
 
1371
create table t1 as select concat(yearweek(20090224)) as c1;
 
1372
show create table t1;
 
1373
Table   Create Table
 
1374
t1      CREATE TABLE `t1` (
 
1375
  `c1` varbinary(6) DEFAULT NULL
 
1376
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
1377
drop table t1;
 
1378
select hex(concat(year(20090224)));
 
1379
hex(concat(year(20090224)))
 
1380
32303039
 
1381
create table t1 as select concat(year(20090224)) as c1;
 
1382
show create table t1;
 
1383
Table   Create Table
 
1384
t1      CREATE TABLE `t1` (
 
1385
  `c1` varbinary(4) DEFAULT NULL
 
1386
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
1387
drop table t1;
 
1388
select hex(concat(weekday(20090224)));
 
1389
hex(concat(weekday(20090224)))
 
1390
31
 
1391
create table t1 as select concat(weekday(20090224)) as c1;
 
1392
show create table t1;
 
1393
Table   Create Table
 
1394
t1      CREATE TABLE `t1` (
 
1395
  `c1` varbinary(1) DEFAULT NULL
 
1396
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
1397
drop table t1;
 
1398
select hex(concat(dayofweek(20090224)));
 
1399
hex(concat(dayofweek(20090224)))
 
1400
33
 
1401
create table t1 as select concat(dayofweek(20090224)) as c1;
 
1402
show create table t1;
 
1403
Table   Create Table
 
1404
t1      CREATE TABLE `t1` (
 
1405
  `c1` varbinary(1) DEFAULT NULL
 
1406
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
1407
drop table t1;
 
1408
select hex(concat(unix_timestamp(20090224)));
 
1409
hex(concat(unix_timestamp(20090224)))
 
1410
31323335343232383030
 
1411
create table t1 as select concat(unix_timestamp(20090224)) as c1;
 
1412
show create table t1;
 
1413
Table   Create Table
 
1414
t1      CREATE TABLE `t1` (
 
1415
  `c1` varbinary(10) NOT NULL DEFAULT ''
 
1416
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
1417
drop table t1;
 
1418
select hex(concat(time_to_sec('10:11:12')));
 
1419
hex(concat(time_to_sec('10:11:12')))
 
1420
3336363732
 
1421
create table t1 as select concat(time_to_sec('10:11:12')) as c1;
 
1422
show create table t1;
 
1423
Table   Create Table
 
1424
t1      CREATE TABLE `t1` (
 
1425
  `c1` varbinary(10) NOT NULL DEFAULT ''
 
1426
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
1427
drop table t1;
 
1428
select hex(concat(extract(year from 20090702)));
 
1429
hex(concat(extract(year from 20090702)))
 
1430
32303039
 
1431
create table t1 as select concat(extract(year from 20090702)) as c1;
 
1432
show create table t1;
 
1433
Table   Create Table
 
1434
t1      CREATE TABLE `t1` (
 
1435
  `c1` varbinary(4) DEFAULT NULL
 
1436
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
1437
drop table t1;
 
1438
select hex(concat(microsecond('12:00:00.123456')));
 
1439
hex(concat(microsecond('12:00:00.123456')))
 
1440
313233343536
 
1441
create table t1 as select concat(microsecond('12:00:00.123456')) as c1;
 
1442
show create table t1;
 
1443
Table   Create Table
 
1444
t1      CREATE TABLE `t1` (
 
1445
  `c1` varbinary(21) DEFAULT NULL
 
1446
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
1447
drop table t1;
 
1448
select hex(concat(month(20090224)));
 
1449
hex(concat(month(20090224)))
 
1450
32
 
1451
create table t1 as select concat(month(20090224)) as c1;
 
1452
show create table t1;
 
1453
Table   Create Table
 
1454
t1      CREATE TABLE `t1` (
 
1455
  `c1` varbinary(2) DEFAULT NULL
 
1456
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
1457
drop table t1;
 
1458
create table t1 as select concat(last_day('2003-02-05')) as c1;
 
1459
show create table t1;
 
1460
Table   Create Table
 
1461
t1      CREATE TABLE `t1` (
 
1462
  `c1` varbinary(10) DEFAULT NULL
 
1463
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
1464
select c1, hex(c1) from t1;
 
1465
c1      hex(c1)
 
1466
2003-02-28      323030332D30322D3238
 
1467
drop table t1;
 
1468
create table t1 as select concat(from_days(730669)) as c1;
 
1469
show create table t1;
 
1470
Table   Create Table
 
1471
t1      CREATE TABLE `t1` (
 
1472
  `c1` varbinary(10) NOT NULL DEFAULT ''
 
1473
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
1474
select c1, hex(c1) from t1;
 
1475
c1      hex(c1)
 
1476
2000-07-03      323030302D30372D3033
 
1477
drop table t1;
 
1478
create table t1 as select concat(curdate()) as c1;
 
1479
show create table t1;
 
1480
Table   Create Table
 
1481
t1      CREATE TABLE `t1` (
 
1482
  `c1` varbinary(10) NOT NULL DEFAULT ''
 
1483
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
1484
drop table t1;
 
1485
create table t1 as select concat(utc_date()) as c1;
 
1486
show create table t1;
 
1487
Table   Create Table
 
1488
t1      CREATE TABLE `t1` (
 
1489
  `c1` varbinary(10) NOT NULL DEFAULT ''
 
1490
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
1491
drop table t1;
 
1492
create table t1 as select concat(curtime()) as c1;
 
1493
show create table t1;
 
1494
Table   Create Table
 
1495
t1      CREATE TABLE `t1` (
 
1496
  `c1` varbinary(8) NOT NULL DEFAULT ''
 
1497
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
1498
drop table t1;
 
1499
create table t1 as select repeat('a',20) as c1 limit 0;
 
1500
set timestamp=1216359724;
 
1501
insert into t1 values (current_date);
 
1502
insert into t1 values (current_time);
 
1503
select c1, hex(c1) from t1;
 
1504
c1      hex(c1)
 
1505
2008-07-18      323030382D30372D3138
 
1506
08:42:04        30383A34323A3034
 
1507
drop table t1;
 
1508
create table t1 as select concat(utc_time()) as c1;
 
1509
show create table t1;
 
1510
Table   Create Table
 
1511
t1      CREATE TABLE `t1` (
 
1512
  `c1` varbinary(8) NOT NULL DEFAULT ''
 
1513
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
1514
drop table t1;
 
1515
select hex(concat(sec_to_time(2378)));
 
1516
hex(concat(sec_to_time(2378)))
 
1517
30303A33393A3338
 
1518
create table t1 as select concat(sec_to_time(2378)) as c1;
 
1519
show create table t1;
 
1520
Table   Create Table
 
1521
t1      CREATE TABLE `t1` (
 
1522
  `c1` varbinary(23) DEFAULT NULL
 
1523
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
1524
drop table t1;
 
1525
select hex(concat(timediff('2001-01-02 00:00:00', '2001-01-01 00:00:00')));
 
1526
hex(concat(timediff('2001-01-02 00:00:00', '2001-01-01 00:00:00')))
 
1527
32343A30303A3030
 
1528
create table t1 as select concat(timediff('2001-01-02 00:00:00', '2001-01-01 00:00:00')) as c1;
 
1529
show create table t1;
 
1530
Table   Create Table
 
1531
t1      CREATE TABLE `t1` (
 
1532
  `c1` varbinary(23) DEFAULT NULL
 
1533
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
1534
drop table t1;
 
1535
select hex(concat(maketime(10,11,12)));
 
1536
hex(concat(maketime(10,11,12)))
 
1537
31303A31313A3132
 
1538
create table t1 as select concat(maketime(10,11,12)) as c1;
 
1539
show create table t1;
 
1540
Table   Create Table
 
1541
t1      CREATE TABLE `t1` (
 
1542
  `c1` varbinary(23) DEFAULT NULL
 
1543
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
1544
drop table t1;
 
1545
select hex(get_format(DATE,'USA'));
 
1546
hex(get_format(DATE,'USA'))
 
1547
256D2E25642E2559
 
1548
create table t1 as select get_format(DATE,'USA') as c1;
 
1549
show create table t1;
 
1550
Table   Create Table
 
1551
t1      CREATE TABLE `t1` (
 
1552
  `c1` varbinary(17) DEFAULT NULL
 
1553
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
1554
drop table t1;
 
1555
select hex(left(concat(from_unixtime(1111885200)),4));
 
1556
hex(left(concat(from_unixtime(1111885200)),4))
 
1557
32303035
 
1558
create table t1 as select concat(from_unixtime(1111885200)) as c1;
 
1559
show create table t1;
 
1560
Table   Create Table
 
1561
t1      CREATE TABLE `t1` (
 
1562
  `c1` varbinary(19) DEFAULT NULL
 
1563
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
1564
drop table t1;
 
1565
select hex(concat(convert_tz('2004-01-01 12:00:00','+10:00','-6:00')));
 
1566
hex(concat(convert_tz('2004-01-01 12:00:00','+10:00','-6:00')))
 
1567
323030332D31322D33312032303A30303A3030
 
1568
create table t1 as select concat(convert_tz('2004-01-01 12:00:00','+10:00','-6:00')) as c1;
 
1569
show create table t1;
 
1570
Table   Create Table
 
1571
t1      CREATE TABLE `t1` (
 
1572
  `c1` varbinary(19) DEFAULT NULL
 
1573
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
1574
drop table t1;
 
1575
select hex(concat(date_add('2004-01-01 12:00:00', interval 1 day)));
 
1576
hex(concat(date_add('2004-01-01 12:00:00', interval 1 day)))
 
1577
323030342D30312D30322031323A30303A3030
 
1578
create table t1 as select concat(date_add('2004-01-01 12:00:00', interval 1 day)) as c1;
 
1579
show create table t1;
 
1580
Table   Create Table
 
1581
t1      CREATE TABLE `t1` (
 
1582
  `c1` varbinary(29) DEFAULT NULL
 
1583
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
1584
select * from t1;
 
1585
c1
 
1586
2004-01-02 12:00:00
 
1587
drop table t1;
 
1588
select hex(concat(makedate(2009,1)));
 
1589
hex(concat(makedate(2009,1)))
 
1590
323030392D30312D3031
 
1591
create table t1 as select concat(makedate(2009,1)) as c1;
 
1592
show create table t1;
 
1593
Table   Create Table
 
1594
t1      CREATE TABLE `t1` (
 
1595
  `c1` varbinary(10) DEFAULT NULL
 
1596
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
1597
select * from t1;
 
1598
c1
 
1599
2009-01-01
 
1600
drop table t1;
 
1601
create table t1 as select concat(now()) as c1;
 
1602
show create table t1;
 
1603
Table   Create Table
 
1604
t1      CREATE TABLE `t1` (
 
1605
  `c1` varbinary(19) NOT NULL DEFAULT ''
 
1606
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
1607
drop table t1;
 
1608
create table t1 as select concat(utc_timestamp()) as c1;
 
1609
show create table t1;
 
1610
Table   Create Table
 
1611
t1      CREATE TABLE `t1` (
 
1612
  `c1` varbinary(19) NOT NULL DEFAULT ''
 
1613
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
1614
drop table t1;
 
1615
create table t1 as select concat(sysdate()) as c1;
 
1616
show create table t1;
 
1617
Table   Create Table
 
1618
t1      CREATE TABLE `t1` (
 
1619
  `c1` varbinary(19) NOT NULL DEFAULT ''
 
1620
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
1621
drop table t1;
 
1622
select hex(concat(addtime('00:00:00','11:22:33')));
 
1623
hex(concat(addtime('00:00:00','11:22:33')))
 
1624
31313A32323A3333
 
1625
create table t1 as select concat(addtime('00:00:00','11:22:33')) as c1;
 
1626
show create table t1;
 
1627
Table   Create Table
 
1628
t1      CREATE TABLE `t1` (
 
1629
  `c1` varbinary(29) DEFAULT NULL
 
1630
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
1631
drop table t1;
 
1632
select hex(concat(subtime('23:59:59','11:22:33')));
 
1633
hex(concat(subtime('23:59:59','11:22:33')))
 
1634
31323A33373A3236
 
1635
create table t1 as select concat(subtime('23:59:59','11:22:33')) as c1;
 
1636
show create table t1;
 
1637
Table   Create Table
 
1638
t1      CREATE TABLE `t1` (
 
1639
  `c1` varbinary(29) DEFAULT NULL
 
1640
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
1641
drop table t1;
 
1642
select hex(elt(1,2,3));
 
1643
hex(elt(1,2,3))
 
1644
32
 
1645
create table t1 as select elt(1,2,3) as c1;
 
1646
show create table t1;
 
1647
Table   Create Table
 
1648
t1      CREATE TABLE `t1` (
 
1649
  `c1` varbinary(1) DEFAULT NULL
 
1650
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
1651
drop table t1;
 
1652
select hex(export_set(1,2,3,4,2));
 
1653
hex(export_set(1,2,3,4,2))
 
1654
323433
 
1655
create table t1 as select export_set(1,2,3,4,2) as c1;
 
1656
show create table t1;
 
1657
Table   Create Table
 
1658
t1      CREATE TABLE `t1` (
 
1659
  `c1` varbinary(127) NOT NULL DEFAULT ''
 
1660
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
1661
drop table t1;
 
1662
select hex(insert(1133,3,0,22));
 
1663
hex(insert(1133,3,0,22))
 
1664
313132323333
 
1665
create table t1 as select insert(1133,3,0,22) as c1;
 
1666
show create table t1;
 
1667
Table   Create Table
 
1668
t1      CREATE TABLE `t1` (
 
1669
  `c1` varbinary(6) NOT NULL DEFAULT ''
 
1670
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
1671
drop table t1;
 
1672
select hex(lcase(123));
 
1673
hex(lcase(123))
 
1674
313233
 
1675
create table t1 as select lcase(123) as c1;
 
1676
show create table t1;
 
1677
Table   Create Table
 
1678
t1      CREATE TABLE `t1` (
 
1679
  `c1` varbinary(3) NOT NULL DEFAULT ''
 
1680
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
1681
drop table t1;
 
1682
select hex(left(123,1));
 
1683
hex(left(123,1))
 
1684
31
 
1685
create table t1 as select left(123,1) as c1;
 
1686
show create table t1;
 
1687
Table   Create Table
 
1688
t1      CREATE TABLE `t1` (
 
1689
  `c1` varbinary(1) NOT NULL DEFAULT ''
 
1690
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
1691
drop table t1;
 
1692
select hex(lower(123));
 
1693
hex(lower(123))
 
1694
313233
 
1695
create table t1 as select lower(123) as c1;
 
1696
show create table t1;
 
1697
Table   Create Table
 
1698
t1      CREATE TABLE `t1` (
 
1699
  `c1` varbinary(3) NOT NULL DEFAULT ''
 
1700
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
1701
drop table t1;
 
1702
select hex(lpad(1,2,0));
 
1703
hex(lpad(1,2,0))
 
1704
3031
 
1705
create table t1 as select lpad(1,2,0) as c1;
 
1706
show create table t1;
 
1707
Table   Create Table
 
1708
t1      CREATE TABLE `t1` (
 
1709
  `c1` varbinary(2) NOT NULL DEFAULT ''
 
1710
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
1711
drop table t1;
 
1712
select hex(ltrim(1));
 
1713
hex(ltrim(1))
 
1714
31
 
1715
create table t1 as select ltrim(1) as c1;
 
1716
show create table t1;
 
1717
Table   Create Table
 
1718
t1      CREATE TABLE `t1` (
 
1719
  `c1` varbinary(1) NOT NULL DEFAULT ''
 
1720
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
1721
drop table t1;
 
1722
select hex(mid(1,1,1));
 
1723
hex(mid(1,1,1))
 
1724
31
 
1725
create table t1 as select mid(1,1,1) as c1;
 
1726
show create table t1;
 
1727
Table   Create Table
 
1728
t1      CREATE TABLE `t1` (
 
1729
  `c1` varbinary(1) NOT NULL DEFAULT ''
 
1730
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
1731
drop table t1;
 
1732
select hex(repeat(1,2));
 
1733
hex(repeat(1,2))
 
1734
3131
 
1735
create table t1 as select repeat(1,2) as c1;
 
1736
show create table t1;
 
1737
Table   Create Table
 
1738
t1      CREATE TABLE `t1` (
 
1739
  `c1` varbinary(2) NOT NULL DEFAULT ''
 
1740
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
1741
drop table t1;
 
1742
select hex(replace(1,1,2));
 
1743
hex(replace(1,1,2))
 
1744
32
 
1745
create table t1 as select replace(1,1,2) as c1;
 
1746
show create table t1;
 
1747
Table   Create Table
 
1748
t1      CREATE TABLE `t1` (
 
1749
  `c1` varbinary(1) NOT NULL DEFAULT ''
 
1750
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
1751
drop table t1;
 
1752
select hex(reverse(12));
 
1753
hex(reverse(12))
 
1754
3231
 
1755
create table t1 as select reverse(12) as c1;
 
1756
show create table t1;
 
1757
Table   Create Table
 
1758
t1      CREATE TABLE `t1` (
 
1759
  `c1` varbinary(2) NOT NULL DEFAULT ''
 
1760
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
1761
drop table t1;
 
1762
select hex(right(123,1));
 
1763
hex(right(123,1))
 
1764
33
 
1765
create table t1 as select right(123,1) as c1;
 
1766
show create table t1;
 
1767
Table   Create Table
 
1768
t1      CREATE TABLE `t1` (
 
1769
  `c1` varbinary(1) NOT NULL DEFAULT ''
 
1770
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
1771
drop table t1;
 
1772
select hex(rpad(1,2,0));
 
1773
hex(rpad(1,2,0))
 
1774
3130
 
1775
create table t1 as select rpad(1,2,0) as c1;
 
1776
show create table t1;
 
1777
Table   Create Table
 
1778
t1      CREATE TABLE `t1` (
 
1779
  `c1` varbinary(2) NOT NULL DEFAULT ''
 
1780
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
1781
drop table t1;
 
1782
select hex(rtrim(1));
 
1783
hex(rtrim(1))
 
1784
31
 
1785
create table t1 as select rtrim(1) as c1;
 
1786
show create table t1;
 
1787
Table   Create Table
 
1788
t1      CREATE TABLE `t1` (
 
1789
  `c1` varbinary(1) NOT NULL DEFAULT ''
 
1790
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
1791
drop table t1;
 
1792
select hex(soundex(1));
 
1793
hex(soundex(1))
 
1794
 
 
1795
create table t1 as select soundex(1) as c1;
 
1796
show create table t1;
 
1797
Table   Create Table
 
1798
t1      CREATE TABLE `t1` (
 
1799
  `c1` varbinary(4) NOT NULL DEFAULT ''
 
1800
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
1801
drop table t1;
 
1802
select hex(substring(1,1,1));
 
1803
hex(substring(1,1,1))
 
1804
31
 
1805
create table t1 as select substring(1,1,1) as c1;
 
1806
show create table t1;
 
1807
Table   Create Table
 
1808
t1      CREATE TABLE `t1` (
 
1809
  `c1` varbinary(1) NOT NULL DEFAULT ''
 
1810
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
1811
drop table t1;
 
1812
select hex(trim(1));
 
1813
hex(trim(1))
 
1814
31
 
1815
create table t1 as select trim(1) as c1;
 
1816
show create table t1;
 
1817
Table   Create Table
 
1818
t1      CREATE TABLE `t1` (
 
1819
  `c1` varbinary(1) NOT NULL DEFAULT ''
 
1820
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
1821
drop table t1;
 
1822
select hex(ucase(1));
 
1823
hex(ucase(1))
 
1824
31
 
1825
create table t1 as select ucase(1) as c1;
 
1826
show create table t1;
 
1827
Table   Create Table
 
1828
t1      CREATE TABLE `t1` (
 
1829
  `c1` varbinary(1) NOT NULL DEFAULT ''
 
1830
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
1831
drop table t1;
 
1832
select hex(upper(1));
 
1833
hex(upper(1))
 
1834
31
 
1835
create table t1 as select upper(1) as c1;
 
1836
show create table t1;
 
1837
Table   Create Table
 
1838
t1      CREATE TABLE `t1` (
 
1839
  `c1` varbinary(1) NOT NULL DEFAULT ''
 
1840
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
1841
drop table t1;
 
1842
create table t1 as select repeat(' ', 64) as a limit 0;
 
1843
show create table t1;
 
1844
Table   Create Table
 
1845
t1      CREATE TABLE `t1` (
 
1846
  `a` varbinary(64) NOT NULL DEFAULT ''
 
1847
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
1848
insert into t1 values ("1.1"), ("2.1");
 
1849
select a, hex(a) from t1;
 
1850
a       hex(a)
 
1851
1.1     312E31
 
1852
2.1     322E31
 
1853
update t1 set a= a + 0.1;
 
1854
select a, hex(a) from t1;
 
1855
a       hex(a)
 
1856
1.2000000000000002      312E32303030303030303030303030303032
 
1857
2.2     322E32
 
1858
drop table t1;
 
1859
create table t1 (a tinyint);
 
1860
insert into t1 values (1);
 
1861
select hex(concat(a)) from t1;
 
1862
hex(concat(a))
 
1863
31
 
1864
create table t2 as select concat(a) from t1;
 
1865
show create table t2;
 
1866
Table   Create Table
 
1867
t2      CREATE TABLE `t2` (
 
1868
  `concat(a)` varbinary(4) DEFAULT NULL
 
1869
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
1870
drop table t1, t2;
 
1871
create table t1 (a tinyint zerofill);
 
1872
insert into t1 values (1), (10), (100);
 
1873
select hex(concat(a)), a from t1;
 
1874
hex(concat(a))  a
 
1875
303031  001
 
1876
303130  010
 
1877
313030  100
 
1878
drop table t1;
 
1879
create table t1 (a tinyint(4) zerofill);
 
1880
insert into t1 values (1), (10), (100);
 
1881
select hex(concat(a)), a from t1;
 
1882
hex(concat(a))  a
 
1883
30303031        0001
 
1884
30303130        0010
 
1885
30313030        0100
 
1886
drop table t1;
 
1887
create table t1 (a decimal(10,2));
 
1888
insert into t1 values (123.45);
 
1889
select hex(concat(a)) from t1;
 
1890
hex(concat(a))
 
1891
3132332E3435
 
1892
create table t2 as select concat(a) from t1;
 
1893
show create table t2;
 
1894
Table   Create Table
 
1895
t2      CREATE TABLE `t2` (
 
1896
  `concat(a)` varbinary(12) DEFAULT NULL
 
1897
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
1898
drop table t1, t2;
 
1899
create table t1 (a smallint);
 
1900
insert into t1 values (1);
 
1901
select hex(concat(a)) from t1;
 
1902
hex(concat(a))
 
1903
31
 
1904
create table t2 as select concat(a) from t1;
 
1905
show create table t2;
 
1906
Table   Create Table
 
1907
t2      CREATE TABLE `t2` (
 
1908
  `concat(a)` varbinary(6) DEFAULT NULL
 
1909
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
1910
drop table t1, t2;
 
1911
create table t1 (a smallint zerofill);
 
1912
insert into t1 values (1), (10), (100), (1000), (10000);
 
1913
select hex(concat(a)), a from t1;
 
1914
hex(concat(a))  a
 
1915
3030303031      00001
 
1916
3030303130      00010
 
1917
3030313030      00100
 
1918
3031303030      01000
 
1919
3130303030      10000
 
1920
drop table t1;
 
1921
create table t1 (a mediumint);
 
1922
insert into t1 values (1);
 
1923
select hex(concat(a)) from t1;
 
1924
hex(concat(a))
 
1925
31
 
1926
create table t2 as select concat(a) from t1;
 
1927
show create table t2;
 
1928
Table   Create Table
 
1929
t2      CREATE TABLE `t2` (
 
1930
  `concat(a)` varbinary(9) DEFAULT NULL
 
1931
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
1932
drop table t1, t2;
 
1933
create table t1 (a mediumint zerofill);
 
1934
insert into t1 values (1), (10), (100), (1000), (10000);
 
1935
select hex(concat(a)), a from t1;
 
1936
hex(concat(a))  a
 
1937
3030303030303031        00000001
 
1938
3030303030303130        00000010
 
1939
3030303030313030        00000100
 
1940
3030303031303030        00001000
 
1941
3030303130303030        00010000
 
1942
drop table t1;
 
1943
create table t1 (a int);
 
1944
insert into t1 values (1);
 
1945
select hex(concat(a)) from t1;
 
1946
hex(concat(a))
 
1947
31
 
1948
create table t2 as select concat(a) from t1;
 
1949
show create table t2;
 
1950
Table   Create Table
 
1951
t2      CREATE TABLE `t2` (
 
1952
  `concat(a)` varbinary(11) DEFAULT NULL
 
1953
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
1954
drop table t1, t2;
 
1955
create table t1 (a int zerofill);
 
1956
insert into t1 values (1), (10), (100), (1000), (10000);
 
1957
select hex(concat(a)), a from t1;
 
1958
hex(concat(a))  a
 
1959
30303030303030303031    0000000001
 
1960
30303030303030303130    0000000010
 
1961
30303030303030313030    0000000100
 
1962
30303030303031303030    0000001000
 
1963
30303030303130303030    0000010000
 
1964
drop table t1;
 
1965
create table t1 (a bigint);
 
1966
insert into t1 values (1);
 
1967
select hex(concat(a)) from t1;
 
1968
hex(concat(a))
 
1969
31
 
1970
create table t2 as select concat(a) from t1;
 
1971
show create table t2;
 
1972
Table   Create Table
 
1973
t2      CREATE TABLE `t2` (
 
1974
  `concat(a)` varbinary(20) DEFAULT NULL
 
1975
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
1976
drop table t1, t2;
 
1977
create table t1 (a bigint zerofill);
 
1978
insert into t1 values (1), (10), (100), (1000), (10000);
 
1979
select hex(concat(a)), a from t1;
 
1980
hex(concat(a))  a
 
1981
3030303030303030303030303030303030303031        00000000000000000001
 
1982
3030303030303030303030303030303030303130        00000000000000000010
 
1983
3030303030303030303030303030303030313030        00000000000000000100
 
1984
3030303030303030303030303030303031303030        00000000000000001000
 
1985
3030303030303030303030303030303130303030        00000000000000010000
 
1986
drop table t1;
 
1987
create table t1 (a float);
 
1988
insert into t1 values (123.456);
 
1989
select hex(concat(a)) from t1;
 
1990
hex(concat(a))
 
1991
3132332E343536
 
1992
select concat(a) from t1;
 
1993
concat(a)
 
1994
123.456
 
1995
create table t2 as select concat(a) from t1;
 
1996
show create table t2;
 
1997
Table   Create Table
 
1998
t2      CREATE TABLE `t2` (
 
1999
  `concat(a)` varbinary(12) DEFAULT NULL
 
2000
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
2001
drop table t1, t2;
 
2002
create table t1 (a float zerofill);
 
2003
insert into t1 values (1.1), (10.1), (100.1), (1000.1), (10000.1);
 
2004
select hex(concat(a)), a from t1;
 
2005
hex(concat(a))  a
 
2006
303030303030303030312E31        0000000001.1
 
2007
303030303030303031302E31        0000000010.1
 
2008
303030303030303130302E31        0000000100.1
 
2009
303030303030313030302E31        0000001000.1
 
2010
303030303031303030302E31        0000010000.1
 
2011
drop table t1;
 
2012
create table t1 (a double);
 
2013
insert into t1 values (123.456);
 
2014
select hex(concat(a)) from t1;
 
2015
hex(concat(a))
 
2016
3132332E343536
 
2017
select concat(a) from t1;
 
2018
concat(a)
 
2019
123.456
 
2020
create table t2 as select concat(a) from t1;
 
2021
show create table t2;
 
2022
Table   Create Table
 
2023
t2      CREATE TABLE `t2` (
 
2024
  `concat(a)` varbinary(22) DEFAULT NULL
 
2025
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
2026
drop table t1, t2;
 
2027
create table t1 (a double zerofill);
 
2028
insert into t1 values (1.1), (10.1), (100.1), (1000.1), (10000.1);
 
2029
select hex(concat(a)), a from t1;
 
2030
hex(concat(a))  a
 
2031
30303030303030303030303030303030303030312E31    00000000000000000001.1
 
2032
30303030303030303030303030303030303031302E31    00000000000000000010.1
 
2033
30303030303030303030303030303030303130302E31    00000000000000000100.1
 
2034
30303030303030303030303030303030313030302E31    00000000000000001000.1
 
2035
30303030303030303030303030303031303030302E31    00000000000000010000.1
 
2036
drop table t1;
 
2037
create table t1 (a year(2));
 
2038
insert into t1 values (1);
 
2039
select hex(concat(a)) from t1;
 
2040
hex(concat(a))
 
2041
3031
 
2042
create table t2 as select concat(a) from t1;
 
2043
show create table t2;
 
2044
Table   Create Table
 
2045
t2      CREATE TABLE `t2` (
 
2046
  `concat(a)` varbinary(2) DEFAULT NULL
 
2047
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
2048
drop table t1, t2;
 
2049
create table t1 (a year);
 
2050
insert into t1 values (1);
 
2051
select hex(concat(a)) from t1;
 
2052
hex(concat(a))
 
2053
32303031
 
2054
create table t2 as select concat(a) from t1;
 
2055
show create table t2;
 
2056
Table   Create Table
 
2057
t2      CREATE TABLE `t2` (
 
2058
  `concat(a)` varbinary(4) DEFAULT NULL
 
2059
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
2060
drop table t1, t2;
 
2061
create table t1 (a bit(64));
 
2062
insert into t1 values (1);
 
2063
select hex(concat(a)) from t1;
 
2064
hex(concat(a))
 
2065
0000000000000001
 
2066
create table t2 as select concat(a) from t1;
 
2067
show create table t2;
 
2068
Table   Create Table
 
2069
t2      CREATE TABLE `t2` (
 
2070
  `concat(a)` varbinary(64) DEFAULT NULL
 
2071
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
2072
drop table t1, t2;
 
2073
create table t1 (a timestamp);
 
2074
insert into t1 values (0);
 
2075
insert into t1 values (20010203040506);
 
2076
insert into t1 values (19800203040506);
 
2077
insert into t1 values ('2001-02-03 04:05:06');
 
2078
select hex(concat(a)) from t1;
 
2079
hex(concat(a))
 
2080
303030302D30302D30302030303A30303A3030
 
2081
323030312D30322D30332030343A30353A3036
 
2082
313938302D30322D30332030343A30353A3036
 
2083
323030312D30322D30332030343A30353A3036
 
2084
select concat(a) from t1;
 
2085
concat(a)
 
2086
0000-00-00 00:00:00
 
2087
2001-02-03 04:05:06
 
2088
1980-02-03 04:05:06
 
2089
2001-02-03 04:05:06
 
2090
create table t2 as select concat(a) from t1;
 
2091
show create table t2;
 
2092
Table   Create Table
 
2093
t2      CREATE TABLE `t2` (
 
2094
  `concat(a)` varbinary(19) NOT NULL DEFAULT ''
 
2095
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
2096
drop table t1, t2;
 
2097
create table t1 (a date);
 
2098
insert into t1 values ('2001-02-03');
 
2099
insert into t1 values (20010203);
 
2100
select hex(concat(a)) from t1;
 
2101
hex(concat(a))
 
2102
323030312D30322D3033
 
2103
323030312D30322D3033
 
2104
create table t2 as select concat(a) from t1;
 
2105
show create table t2;
 
2106
Table   Create Table
 
2107
t2      CREATE TABLE `t2` (
 
2108
  `concat(a)` varbinary(10) DEFAULT NULL
 
2109
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
2110
drop table t1, t2;
 
2111
create table t1 (a time);
 
2112
insert into t1 values (1);
 
2113
insert into t1 values ('01:02:03');
 
2114
select hex(concat(a)) from t1;
 
2115
hex(concat(a))
 
2116
30303A30303A3031
 
2117
30313A30323A3033
 
2118
select concat(a) from t1;
 
2119
concat(a)
 
2120
00:00:01
 
2121
01:02:03
 
2122
create table t2 as select concat(a) from t1;
 
2123
show create table t2;
 
2124
Table   Create Table
 
2125
t2      CREATE TABLE `t2` (
 
2126
  `concat(a)` varbinary(8) DEFAULT NULL
 
2127
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
2128
drop table t1, t2;
 
2129
create table t1 (a datetime);
 
2130
insert into t1 values ('2001-02-03 04:05:06');
 
2131
insert into t1 values (20010203040506);
 
2132
select hex(concat(a)) from t1;
 
2133
hex(concat(a))
 
2134
323030312D30322D30332030343A30353A3036
 
2135
323030312D30322D30332030343A30353A3036
 
2136
create table t2 as select concat(a) from t1;
 
2137
show create table t2;
 
2138
Table   Create Table
 
2139
t2      CREATE TABLE `t2` (
 
2140
  `concat(a)` varbinary(19) DEFAULT NULL
 
2141
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
2142
drop table t1, t2;
 
2143
create table t1 (a tinyint);
 
2144
insert into t1 values (1);
 
2145
create view v1(a) as select concat(a) from t1;
 
2146
show columns from v1;
 
2147
Field   Type    Null    Key     Default Extra
 
2148
a       varbinary(4)    YES             NULL    
 
2149
select hex(a) from v1;
 
2150
hex(a)
 
2151
31
 
2152
drop table t1;
 
2153
drop view v1;
 
2154
create table t1 (a tinyint zerofill);
 
2155
insert into t1 values (1), (10), (100);
 
2156
create view v1(a) as select concat(a) from t1;
 
2157
show columns from v1;
 
2158
Field   Type    Null    Key     Default Extra
 
2159
a       varbinary(3)    YES             NULL    
 
2160
select hex(a) from v1;
 
2161
hex(a)
 
2162
303031
 
2163
303130
 
2164
313030
 
2165
drop table t1;
 
2166
drop view v1;
 
2167
create table t1 (a tinyint(30) zerofill);
 
2168
insert into t1 values (1), (10), (100);
 
2169
create view v1(a) as select concat(a) from t1;
 
2170
show columns from v1;
 
2171
Field   Type    Null    Key     Default Extra
 
2172
a       varbinary(30)   YES             NULL    
 
2173
select hex(a) from v1;
 
2174
hex(a)
 
2175
303030303030303030303030303030303030303030303030303030303031
 
2176
303030303030303030303030303030303030303030303030303030303130
 
2177
303030303030303030303030303030303030303030303030303030313030
 
2178
drop table t1;
 
2179
drop view v1;
 
2180
create table t1 (a decimal(10,2));
 
2181
insert into t1 values (123.45);
 
2182
create view v1(a) as select concat(a) from t1;
 
2183
show columns from v1;
 
2184
Field   Type    Null    Key     Default Extra
 
2185
a       varbinary(12)   YES             NULL    
 
2186
select hex(a) from v1;
 
2187
hex(a)
 
2188
3132332E3435
 
2189
drop table t1;
 
2190
drop view v1;
 
2191
create table t1 (a smallint);
 
2192
insert into t1 values (1);
 
2193
create view v1(a) as select concat(a) from t1;
 
2194
show columns from v1;
 
2195
Field   Type    Null    Key     Default Extra
 
2196
a       varbinary(6)    YES             NULL    
 
2197
select hex(a) from v1;
 
2198
hex(a)
 
2199
31
 
2200
drop table t1;
 
2201
drop view v1;
 
2202
create table t1 (a smallint zerofill);
 
2203
insert into t1 values (1), (10), (100), (1000), (10000);
 
2204
create view v1(a) as select concat(a) from t1;
 
2205
show columns from v1;
 
2206
Field   Type    Null    Key     Default Extra
 
2207
a       varbinary(5)    YES             NULL    
 
2208
select hex(a) from v1;
 
2209
hex(a)
 
2210
3030303031
 
2211
3030303130
 
2212
3030313030
 
2213
3031303030
 
2214
3130303030
 
2215
drop table t1;
 
2216
drop view v1;
 
2217
create table t1 (a mediumint);
 
2218
insert into t1 values (1);
 
2219
create view v1(a) as select concat(a) from t1;
 
2220
show columns from v1;
 
2221
Field   Type    Null    Key     Default Extra
 
2222
a       varbinary(9)    YES             NULL    
 
2223
select hex(a) from v1;
 
2224
hex(a)
 
2225
31
 
2226
drop table t1;
 
2227
drop view v1;
 
2228
create table t1 (a mediumint zerofill);
 
2229
insert into t1 values (1), (10), (100), (1000), (10000);
 
2230
create view v1(a) as select concat(a) from t1;
 
2231
show columns from v1;
 
2232
Field   Type    Null    Key     Default Extra
 
2233
a       varbinary(8)    YES             NULL    
 
2234
select hex(a) from v1;
 
2235
hex(a)
 
2236
3030303030303031
 
2237
3030303030303130
 
2238
3030303030313030
 
2239
3030303031303030
 
2240
3030303130303030
 
2241
drop table t1;
 
2242
drop view v1;
 
2243
create table t1 (a int);
 
2244
insert into t1 values (1);
 
2245
create view v1(a) as select concat(a) from t1;
 
2246
show columns from v1;
 
2247
Field   Type    Null    Key     Default Extra
 
2248
a       varbinary(11)   YES             NULL    
 
2249
select hex(a) from v1;
 
2250
hex(a)
 
2251
31
 
2252
drop table t1;
 
2253
drop view v1;
 
2254
create table t1 (a int zerofill);
 
2255
insert into t1 values (1), (10), (100), (1000), (10000);
 
2256
create view v1(a) as select concat(a) from t1;
 
2257
show columns from v1;
 
2258
Field   Type    Null    Key     Default Extra
 
2259
a       varbinary(10)   YES             NULL    
 
2260
select hex(a) from v1;
 
2261
hex(a)
 
2262
30303030303030303031
 
2263
30303030303030303130
 
2264
30303030303030313030
 
2265
30303030303031303030
 
2266
30303030303130303030
 
2267
drop table t1;
 
2268
drop view v1;
 
2269
create table t1 (a bigint);
 
2270
insert into t1 values (1);
 
2271
create view v1(a) as select concat(a) from t1;
 
2272
show columns from v1;
 
2273
Field   Type    Null    Key     Default Extra
 
2274
a       varbinary(20)   YES             NULL    
 
2275
select hex(a) from v1;
 
2276
hex(a)
 
2277
31
 
2278
drop table t1;
 
2279
drop view v1;
 
2280
create table t1 (a bigint zerofill);
 
2281
insert into t1 values (1), (10), (100), (1000), (10000);
 
2282
create view v1(a) as select concat(a) from t1;
 
2283
show columns from v1;
 
2284
Field   Type    Null    Key     Default Extra
 
2285
a       varbinary(20)   YES             NULL    
 
2286
select hex(a) from v1;
 
2287
hex(a)
 
2288
3030303030303030303030303030303030303031
 
2289
3030303030303030303030303030303030303130
 
2290
3030303030303030303030303030303030313030
 
2291
3030303030303030303030303030303031303030
 
2292
3030303030303030303030303030303130303030
 
2293
drop table t1;
 
2294
drop view v1;
 
2295
create table t1 (a float);
 
2296
insert into t1 values (123.456);
 
2297
create view v1(a) as select concat(a) from t1;
 
2298
show columns from v1;
 
2299
Field   Type    Null    Key     Default Extra
 
2300
a       varbinary(12)   YES             NULL    
 
2301
select hex(a) from v1;
 
2302
hex(a)
 
2303
3132332E343536
 
2304
drop table t1;
 
2305
drop view v1;
 
2306
create table t1 (a float zerofill);
 
2307
insert into t1 values (1.1), (10.1), (100.1), (1000.1), (10000.1);
 
2308
create view v1(a) as select concat(a) from t1;
 
2309
show columns from v1;
 
2310
Field   Type    Null    Key     Default Extra
 
2311
a       varbinary(12)   YES             NULL    
 
2312
select hex(a) from v1;
 
2313
hex(a)
 
2314
303030303030303030312E31
 
2315
303030303030303031302E31
 
2316
303030303030303130302E31
 
2317
303030303030313030302E31
 
2318
303030303031303030302E31
 
2319
drop table t1;
 
2320
drop view v1;
 
2321
create table t1 (a double);
 
2322
insert into t1 values (123.456);
 
2323
select concat(a) from t1;
 
2324
concat(a)
 
2325
123.456
 
2326
create view v1(a) as select concat(a) from t1;
 
2327
show columns from v1;
 
2328
Field   Type    Null    Key     Default Extra
 
2329
a       varbinary(22)   YES             NULL    
 
2330
select hex(a) from v1;
 
2331
hex(a)
 
2332
3132332E343536
 
2333
drop table t1;
 
2334
drop view v1;
 
2335
create table t1 (a double zerofill);
 
2336
insert into t1 values (1.1), (10.1), (100.1), (1000.1), (10000.1);
 
2337
create view v1(a) as select concat(a) from t1;
 
2338
show columns from v1;
 
2339
Field   Type    Null    Key     Default Extra
 
2340
a       varbinary(22)   YES             NULL    
 
2341
select hex(a) from v1;
 
2342
hex(a)
 
2343
30303030303030303030303030303030303030312E31
 
2344
30303030303030303030303030303030303031302E31
 
2345
30303030303030303030303030303030303130302E31
 
2346
30303030303030303030303030303030313030302E31
 
2347
30303030303030303030303030303031303030302E31
 
2348
drop table t1;
 
2349
drop view v1;
 
2350
create table t1 (a year(2));
 
2351
insert into t1 values (1);
 
2352
create view v1(a) as select concat(a) from t1;
 
2353
show columns from v1;
 
2354
Field   Type    Null    Key     Default Extra
 
2355
a       varbinary(2)    YES             NULL    
 
2356
select hex(a) from v1;
 
2357
hex(a)
 
2358
3031
 
2359
drop table t1;
 
2360
drop view v1;
 
2361
create table t1 (a year);
 
2362
insert into t1 values (1);
 
2363
create view v1(a) as select concat(a) from t1;
 
2364
show columns from v1;
 
2365
Field   Type    Null    Key     Default Extra
 
2366
a       varbinary(4)    YES             NULL    
 
2367
select hex(a) from v1;
 
2368
hex(a)
 
2369
32303031
 
2370
drop table t1;
 
2371
drop view v1;
 
2372
create table t1 (a bit(64));
 
2373
insert into t1 values (1);
 
2374
create view v1(a) as select concat(a) from t1;
 
2375
show columns from v1;
 
2376
Field   Type    Null    Key     Default Extra
 
2377
a       varbinary(64)   YES             NULL    
 
2378
select hex(a) from v1;
 
2379
hex(a)
 
2380
0000000000000001
 
2381
drop table t1;
 
2382
drop view v1;
 
2383
create table t1 (a timestamp);
 
2384
insert into t1 values (0);
 
2385
insert into t1 values (20010203040506);
 
2386
insert into t1 values (19800203040506);
 
2387
insert into t1 values ('2001-02-03 04:05:06');
 
2388
create view v1(a) as select concat(a) from t1;
 
2389
show columns from v1;
 
2390
Field   Type    Null    Key     Default Extra
 
2391
a       varbinary(19)   NO                      
 
2392
select hex(a) from v1;
 
2393
hex(a)
 
2394
303030302D30302D30302030303A30303A3030
 
2395
323030312D30322D30332030343A30353A3036
 
2396
313938302D30322D30332030343A30353A3036
 
2397
323030312D30322D30332030343A30353A3036
 
2398
drop table t1;
 
2399
drop view v1;
 
2400
create table t1 (a date);
 
2401
insert into t1 values ('2001-02-03');
 
2402
insert into t1 values (20010203);
 
2403
create view v1(a) as select concat(a) from t1;
 
2404
show columns from v1;
 
2405
Field   Type    Null    Key     Default Extra
 
2406
a       varbinary(10)   YES             NULL    
 
2407
select hex(a) from v1;
 
2408
hex(a)
 
2409
323030312D30322D3033
 
2410
323030312D30322D3033
 
2411
drop table t1;
 
2412
drop view v1;
 
2413
create table t1 (a time);
 
2414
insert into t1 values (1);
 
2415
insert into t1 values ('01:02:03');
 
2416
create view v1(a) as select concat(a) from t1;
 
2417
show columns from v1;
 
2418
Field   Type    Null    Key     Default Extra
 
2419
a       varbinary(8)    YES             NULL    
 
2420
select hex(a) from v1;
 
2421
hex(a)
 
2422
30303A30303A3031
 
2423
30313A30323A3033
 
2424
drop table t1;
 
2425
drop view v1;
 
2426
create table t1 (a datetime);
 
2427
insert into t1 values ('2001-02-03 04:05:06');
 
2428
insert into t1 values (20010203040506);
 
2429
create view v1(a) as select concat(a) from t1;
 
2430
show columns from v1;
 
2431
Field   Type    Null    Key     Default Extra
 
2432
a       varbinary(19)   YES             NULL    
 
2433
select hex(a) from v1;
 
2434
hex(a)
 
2435
323030312D30322D30332030343A30353A3036
 
2436
323030312D30322D30332030343A30353A3036
 
2437
drop table t1;
 
2438
drop view v1;
 
2439
create function f1 (par1 int) returns int
 
2440
begin
 
2441
return concat(par1);
 
2442
end|
 
2443
set @a= f1(1);
 
2444
select hex(@a);
 
2445
hex(@a)
 
2446
1
 
2447
select hex(concat(f1(1)));
 
2448
hex(concat(f1(1)))
 
2449
31
 
2450
create table t1 as select f1(1) as c1;
 
2451
show create table t1;
 
2452
Table   Create Table
 
2453
t1      CREATE TABLE `t1` (
 
2454
  `c1` int(11) DEFAULT NULL
 
2455
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
2456
drop table t1;
 
2457
create table t1 as select concat(f1(1)) as c1;
 
2458
show create table t1;
 
2459
Table   Create Table
 
2460
t1      CREATE TABLE `t1` (
 
2461
  `c1` varchar(11) DEFAULT NULL
 
2462
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
2463
create view v1 as select concat(f1(1)) as c1;
 
2464
show columns from v1;
 
2465
Field   Type    Null    Key     Default Extra
 
2466
c1      varchar(11)     YES             NULL    
 
2467
drop table t1;
 
2468
drop view v1;
 
2469
drop function f1;
 
2470
create function f1 (par1 decimal(18,2)) returns decimal(18,2)
 
2471
begin
 
2472
return concat(par1);
 
2473
end|
 
2474
set @a= f1(123.45);
 
2475
select hex(@a);
 
2476
hex(@a)
 
2477
7B
 
2478
select hex(concat(f1(123.45)));
 
2479
hex(concat(f1(123.45)))
 
2480
3132332E3435
 
2481
create table t1 as select f1(123.45) as c1;
 
2482
show create table t1;
 
2483
Table   Create Table
 
2484
t1      CREATE TABLE `t1` (
 
2485
  `c1` decimal(18,2) DEFAULT NULL
 
2486
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
2487
drop table t1;
 
2488
create table t1 as select concat(f1(123.45)) as c1;
 
2489
show create table t1;
 
2490
Table   Create Table
 
2491
t1      CREATE TABLE `t1` (
 
2492
  `c1` varchar(20) DEFAULT NULL
 
2493
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
2494
create view v1 as select concat(f1(123.45)) as c1;
 
2495
show columns from v1;
 
2496
Field   Type    Null    Key     Default Extra
 
2497
c1      varchar(20)     YES             NULL    
 
2498
drop table t1;
 
2499
drop view v1;
 
2500
drop function f1;
 
2501
create function f1 (par1 float) returns float
 
2502
begin
 
2503
return concat(par1);
 
2504
end|
 
2505
set @a= f1(123.45);
 
2506
select hex(@a);
 
2507
hex(@a)
 
2508
7B
 
2509
select hex(concat(f1(123.45)));
 
2510
hex(concat(f1(123.45)))
 
2511
3132332E3435
 
2512
create table t1 as select f1(123.45) as c1;
 
2513
show create table t1;
 
2514
Table   Create Table
 
2515
t1      CREATE TABLE `t1` (
 
2516
  `c1` float DEFAULT NULL
 
2517
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
2518
drop table t1;
 
2519
create table t1 as select concat(f1(123.45)) as c1;
 
2520
show create table t1;
 
2521
Table   Create Table
 
2522
t1      CREATE TABLE `t1` (
 
2523
  `c1` varchar(12) DEFAULT NULL
 
2524
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
2525
create view v1 as select concat(f1(123.45)) as c1;
 
2526
show columns from v1;
 
2527
Field   Type    Null    Key     Default Extra
 
2528
c1      varchar(12)     YES             NULL    
 
2529
drop table t1;
 
2530
drop view v1;
 
2531
drop function f1;
 
2532
create function f1 (par1 date) returns date
 
2533
begin
 
2534
return concat(par1);
 
2535
end|
 
2536
set @a= f1(cast('2001-01-02' as date));
 
2537
select hex(@a);
 
2538
hex(@a)
 
2539
323030312D30312D3032
 
2540
select hex(concat(f1(cast('2001-01-02' as date))));
 
2541
hex(concat(f1(cast('2001-01-02' as date))))
 
2542
323030312D30312D3032
 
2543
create table t1 as select f1(cast('2001-01-02' as date)) as c1;
 
2544
show create table t1;
 
2545
Table   Create Table
 
2546
t1      CREATE TABLE `t1` (
 
2547
  `c1` date DEFAULT NULL
 
2548
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
2549
drop table t1;
 
2550
create table t1 as select concat(f1(cast('2001-01-02' as date))) as c1;
 
2551
show create table t1;
 
2552
Table   Create Table
 
2553
t1      CREATE TABLE `t1` (
 
2554
  `c1` varchar(10) DEFAULT NULL
 
2555
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
2556
create view v1 as select concat(f1(cast('2001-01-02' as date))) as c1;
 
2557
show columns from v1;
 
2558
Field   Type    Null    Key     Default Extra
 
2559
c1      varchar(10)     YES             NULL    
 
2560
drop table t1;
 
2561
drop view v1;
 
2562
drop function f1;
 
2563
#
 
2564
# End of WL#2649 Number-to-string conversions
 
2565
#
 
2566
#
 
2567
# End of 5.5 tests
 
2568
#