~ubuntu-branches/ubuntu/trusty/drizzle/trusty

« back to all changes in this revision

Viewing changes to plugin/embedded_innodb/test-suite-dir/embedded_innodb/tests/r/type_blob.result

  • Committer: Bazaar Package Importer
  • Author(s): Monty Taylor
  • Date: 2010-10-02 14:17:48 UTC
  • mfrom: (1.1.1 upstream)
  • mto: (2.1.17 sid)
  • mto: This revision was merged to the branch mainline in revision 3.
  • Revision ID: james.westby@ubuntu.com-20101002141748-m6vbfbfjhrw1153e
Tags: 2010.09.1802-1
* New upstream release.
* Removed pid-file argument hack.
* Updated GPL-2 address to be new address.
* Directly copy in drizzledump.1 since debian doesn't have sphinx 1.0 yet.
* Link to jquery from libjs-jquery. Add it as a depend.
* Add drizzled.8 symlink to the install files.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
drop table if exists t1,t2,t3,t4,t5,t6,t7;
 
2
CREATE TABLE t1 (a blob, b text, c blob, d text, e text);
 
3
show columns from t1;
 
4
Field   Type    Null    Default Default_is_NULL On_Update
 
5
a       BLOB    YES             YES     
 
6
b       TEXT    YES             YES     
 
7
c       BLOB    YES             YES     
 
8
d       TEXT    YES             YES     
 
9
e       TEXT    YES             YES     
 
10
CREATE TABLE t2 (a varchar(255), b blob, c blob);
 
11
CREATE TABLE t4 (c varchar(16383) not null);
 
12
show columns from t2;
 
13
Field   Type    Null    Default Default_is_NULL On_Update
 
14
a       VARCHAR YES             YES     
 
15
b       BLOB    YES             YES     
 
16
c       BLOB    YES             YES     
 
17
create table t3 (a int, b int);
 
18
show create TABLE t3;
 
19
Table   Create Table
 
20
t3      CREATE TABLE `t3` (
 
21
  `a` INT DEFAULT NULL,
 
22
  `b` INT DEFAULT NULL
 
23
) ENGINE=DEFAULT COLLATE = utf8_general_ci
 
24
show create TABLE t4;
 
25
Table   Create Table
 
26
t4      CREATE TABLE `t4` (
 
27
  `c` VARCHAR(16383) COLLATE utf8_general_ci NOT NULL
 
28
) ENGINE=DEFAULT COLLATE = utf8_general_ci
 
29
drop table t1,t2,t3,t4;
 
30
CREATE TABLE t1 (a blob default "hello");
 
31
ERROR 42000: BLOB/TEXT column 'a' can't have a default value
 
32
CREATE TABLE t2 (a varchar(256));
 
33
drop table t2;
 
34
CREATE TABLE t1 (a varchar(70000) default "hello");
 
35
ERROR 42000: Column length too big for column 'a' (max = 65535); use BLOB or TEXT instead
 
36
CREATE TABLE t2 (a blob default "hello");
 
37
ERROR 42000: BLOB/TEXT column 'a' can't have a default value
 
38
drop table if exists t1,t2;
 
39
create table t1 (nr int not null auto_increment,b blob,str char(10), primary key (nr));
 
40
insert into t1 values (null,"a","A");
 
41
insert into t1 values (null,"bbb","BBB");
 
42
insert into t1 values (null,"ccc","CCC");
 
43
select last_insert_id();
 
44
last_insert_id()
 
45
3
 
46
select * from t1,t1 as t2;
 
47
nr      b       str     nr      b       str
 
48
1       a       A       1       a       A
 
49
2       bbb     BBB     1       a       A
 
50
3       ccc     CCC     1       a       A
 
51
1       a       A       2       bbb     BBB
 
52
2       bbb     BBB     2       bbb     BBB
 
53
3       ccc     CCC     2       bbb     BBB
 
54
1       a       A       3       ccc     CCC
 
55
2       bbb     BBB     3       ccc     CCC
 
56
3       ccc     CCC     3       ccc     CCC
 
57
drop table t1;
 
58
create table t1 (a text);
 
59
insert into t1 values ('where');
 
60
update t1 set a='Where';
 
61
select * from t1;
 
62
a
 
63
Where
 
64
drop table t1;
 
65
create table t1 (t text,c varchar(10),b blob, d blob);
 
66
insert into t1 values (NULL,NULL,NULL,NULL);
 
67
insert into t1 values ("","","","");
 
68
insert into t1 values ("hello","hello","hello","hello");
 
69
insert into t1 values ("HELLO","HELLO","HELLO","HELLO");
 
70
insert into t1 values ("HELLO MY","HELLO MY","HELLO MY","HELLO MY");
 
71
insert into t1 values ("a","a","a","a");
 
72
insert into t1 values (1,1,1,1);
 
73
insert into t1 values (NULL,NULL,NULL,NULL);
 
74
update t1 set c="",b=null where c="1";
 
75
select t from t1 where t like "hello";
 
76
t
 
77
hello
 
78
HELLO
 
79
select c from t1 where c like "hello";
 
80
c
 
81
hello
 
82
HELLO
 
83
select b from t1 where b like "hello";
 
84
b
 
85
hello
 
86
select d from t1 where d like "hello";
 
87
d
 
88
hello
 
89
select c from t1 having c like "hello";
 
90
c
 
91
hello
 
92
HELLO
 
93
select d from t1 having d like "hello";
 
94
d
 
95
hello
 
96
select t from t1 where t like "%HELLO%";
 
97
t
 
98
hello
 
99
HELLO
 
100
HELLO MY
 
101
select c from t1 where c like "%HELLO%";
 
102
c
 
103
hello
 
104
HELLO
 
105
HELLO MY
 
106
select b from t1 where b like "%HELLO%";
 
107
b
 
108
HELLO
 
109
HELLO MY
 
110
select d from t1 where d like "%HELLO%";
 
111
d
 
112
HELLO
 
113
HELLO MY
 
114
select c from t1 having c like "%HELLO%";
 
115
c
 
116
hello
 
117
HELLO
 
118
HELLO MY
 
119
select d from t1 having d like "%HELLO%";
 
120
d
 
121
HELLO
 
122
HELLO MY
 
123
select d from t1 having d like "%HE%LLO%";
 
124
d
 
125
HELLO
 
126
HELLO MY
 
127
select t from t1 order by t;
 
128
t
 
129
NULL
 
130
NULL
 
131
 
 
132
1
 
133
a
 
134
hello
 
135
HELLO
 
136
HELLO MY
 
137
select c from t1 order by c;
 
138
c
 
139
NULL
 
140
NULL
 
141
 
 
142
 
 
143
a
 
144
hello
 
145
HELLO
 
146
HELLO MY
 
147
select b from t1 order by b;
 
148
b
 
149
NULL
 
150
NULL
 
151
NULL
 
152
 
 
153
HELLO
 
154
HELLO MY
 
155
a
 
156
hello
 
157
select d from t1 order by d;
 
158
d
 
159
NULL
 
160
NULL
 
161
 
 
162
1
 
163
HELLO
 
164
HELLO MY
 
165
a
 
166
hello
 
167
select distinct t from t1;
 
168
t
 
169
NULL
 
170
 
 
171
hello
 
172
HELLO MY
 
173
a
 
174
1
 
175
select distinct b from t1;
 
176
b
 
177
NULL
 
178
 
 
179
hello
 
180
HELLO
 
181
HELLO MY
 
182
a
 
183
select distinct t from t1 order by t;
 
184
t
 
185
NULL
 
186
 
 
187
1
 
188
a
 
189
hello
 
190
HELLO MY
 
191
select distinct b from t1 order by b;
 
192
b
 
193
NULL
 
194
 
 
195
HELLO
 
196
HELLO MY
 
197
a
 
198
hello
 
199
select t from t1 group by t;
 
200
t
 
201
NULL
 
202
 
 
203
1
 
204
a
 
205
hello
 
206
HELLO MY
 
207
select b from t1 group by b;
 
208
b
 
209
NULL
 
210
 
 
211
HELLO
 
212
HELLO MY
 
213
a
 
214
hello
 
215
select distinct t from t1;
 
216
t
 
217
NULL
 
218
 
 
219
hello
 
220
HELLO MY
 
221
a
 
222
1
 
223
select distinct b from t1;
 
224
b
 
225
NULL
 
226
 
 
227
hello
 
228
HELLO
 
229
HELLO MY
 
230
a
 
231
select distinct t from t1 order by t;
 
232
t
 
233
NULL
 
234
 
 
235
1
 
236
a
 
237
hello
 
238
HELLO MY
 
239
select distinct b from t1 order by b;
 
240
b
 
241
NULL
 
242
 
 
243
HELLO
 
244
HELLO MY
 
245
a
 
246
hello
 
247
select distinct c from t1;
 
248
c
 
249
NULL
 
250
 
 
251
hello
 
252
HELLO MY
 
253
a
 
254
select distinct d from t1;
 
255
d
 
256
NULL
 
257
 
 
258
hello
 
259
HELLO
 
260
HELLO MY
 
261
a
 
262
1
 
263
select distinct c from t1 order by c;
 
264
c
 
265
NULL
 
266
 
 
267
a
 
268
hello
 
269
HELLO MY
 
270
select distinct d from t1 order by d;
 
271
d
 
272
NULL
 
273
 
 
274
1
 
275
HELLO
 
276
HELLO MY
 
277
a
 
278
hello
 
279
select c from t1 group by c;
 
280
c
 
281
NULL
 
282
 
 
283
a
 
284
hello
 
285
HELLO MY
 
286
select d from t1 group by d;
 
287
d
 
288
NULL
 
289
 
 
290
1
 
291
HELLO
 
292
HELLO MY
 
293
a
 
294
hello
 
295
select distinct * from t1;
 
296
t       c       b       d
 
297
NULL    NULL    NULL    NULL
 
298
                        
 
299
hello   hello   hello   hello
 
300
HELLO   HELLO   HELLO   HELLO
 
301
HELLO MY        HELLO MY        HELLO MY        HELLO MY
 
302
a       a       a       a
 
303
1               NULL    1
 
304
select t,count(*) from t1 group by t;
 
305
t       count(*)
 
306
NULL    2
 
307
        1
 
308
1       1
 
309
a       1
 
310
hello   2
 
311
HELLO MY        1
 
312
select b,count(*) from t1 group by b;
 
313
b       count(*)
 
314
NULL    3
 
315
        1
 
316
HELLO   1
 
317
HELLO MY        1
 
318
a       1
 
319
hello   1
 
320
select c,count(*) from t1 group by c;
 
321
c       count(*)
 
322
NULL    2
 
323
        2
 
324
a       1
 
325
hello   2
 
326
HELLO MY        1
 
327
select d,count(*) from t1 group by d;
 
328
d       count(*)
 
329
NULL    2
 
330
        1
 
331
1       1
 
332
HELLO   1
 
333
HELLO MY        1
 
334
a       1
 
335
hello   1
 
336
drop table t1;
 
337
create table t1 (a text, unique (a(2100)));
 
338
ERROR 42000: Specified key was too long; max key length is 767 bytes
 
339
create table t1 (a text, key (a(2100)));
 
340
Warnings:
 
341
Warning 1071    Specified key was too long; max key length is 767 bytes
 
342
show create table t1;
 
343
Table   Create Table
 
344
t1      CREATE TABLE `t1` (
 
345
  `a` TEXT COLLATE utf8_general_ci,
 
346
  KEY `a` (`a`(191)) USING BTREE
 
347
) ENGINE=DEFAULT COLLATE = utf8_general_ci
 
348
drop table t1;
 
349
CREATE TABLE t1 (
 
350
t1_id bigint NOT NULL auto_increment,
 
351
_field_72 varchar(128) DEFAULT '' NOT NULL,
 
352
_field_95 varchar(32),
 
353
_field_115 int DEFAULT '0' NOT NULL,
 
354
_field_122 int DEFAULT '0' NOT NULL,
 
355
_field_126 int,
 
356
_field_134 int,
 
357
PRIMARY KEY (t1_id),
 
358
UNIQUE _field_72 (_field_72),
 
359
KEY _field_115 (_field_115),
 
360
KEY _field_122 (_field_122)
 
361
);
 
362
INSERT INTO t1 VALUES (1,'admin','21232f297a57a5a743894a0e4a801fc3',0,1,NULL,NULL);
 
363
INSERT INTO t1 VALUES (2,'hroberts','7415275a8c95952901e42b13a6b78566',0,1,NULL,NULL);
 
364
INSERT INTO t1 VALUES (3,'guest','d41d8cd98f00b204e9800998ecf8427e',1,0,NULL,NULL);
 
365
CREATE TABLE t2 (
 
366
seq_0_id bigint DEFAULT '0' NOT NULL,
 
367
seq_1_id bigint DEFAULT '0' NOT NULL,
 
368
PRIMARY KEY (seq_0_id,seq_1_id)
 
369
);
 
370
INSERT INTO t2 VALUES (1,1);
 
371
INSERT INTO t2 VALUES (2,1);
 
372
INSERT INTO t2 VALUES (2,2);
 
373
CREATE TABLE t3 (
 
374
t3_id bigint NOT NULL auto_increment,
 
375
_field_131 varchar(128),
 
376
_field_133 int DEFAULT '0' NOT NULL,
 
377
_field_135 datetime,
 
378
_field_137 int,
 
379
_field_139 datetime,
 
380
_field_140 blob,
 
381
_field_142 int DEFAULT '0' NOT NULL,
 
382
_field_145 int DEFAULT '0' NOT NULL,
 
383
_field_148 int DEFAULT '0' NOT NULL,
 
384
PRIMARY KEY (t3_id),
 
385
KEY _field_133 (_field_133),
 
386
KEY _field_135 (_field_135),
 
387
KEY _field_139 (_field_139),
 
388
KEY _field_142 (_field_142),
 
389
KEY _field_145 (_field_145),
 
390
KEY _field_148 (_field_148)
 
391
);
 
392
INSERT INTO t3 VALUES (1,'test job 1',0,NULL,0,'1999-02-25 22:43:32','test\r\njob\r\n1',0,0,0);
 
393
INSERT INTO t3 VALUES (2,'test job 2',0,NULL,0,'1999-02-26 21:08:04','',0,0,0);
 
394
CREATE TABLE t4 (
 
395
seq_0_id bigint DEFAULT '0' NOT NULL,
 
396
seq_1_id bigint DEFAULT '0' NOT NULL,
 
397
PRIMARY KEY (seq_0_id,seq_1_id)
 
398
);
 
399
INSERT INTO t4 VALUES (1,1);
 
400
INSERT INTO t4 VALUES (2,1);
 
401
CREATE TABLE t5 (
 
402
t5_id bigint NOT NULL auto_increment,
 
403
_field_149 int,
 
404
_field_156 varchar(128) DEFAULT '' NOT NULL,
 
405
_field_157 varchar(128) DEFAULT '' NOT NULL,
 
406
_field_158 varchar(128) DEFAULT '' NOT NULL,
 
407
_field_159 varchar(128) DEFAULT '' NOT NULL,
 
408
_field_160 varchar(128) DEFAULT '' NOT NULL,
 
409
_field_161 varchar(128) DEFAULT '' NOT NULL,
 
410
PRIMARY KEY (t5_id),
 
411
KEY _field_156 (_field_156),
 
412
KEY _field_157 (_field_157),
 
413
KEY _field_158 (_field_158),
 
414
KEY _field_159 (_field_159),
 
415
KEY _field_160 (_field_160),
 
416
KEY _field_161 (_field_161)
 
417
);
 
418
INSERT INTO t5 VALUES (1,0,'tomato','','','','','');
 
419
INSERT INTO t5 VALUES (2,0,'cilantro','','','','','');
 
420
CREATE TABLE t6 (
 
421
seq_0_id bigint DEFAULT '0' NOT NULL,
 
422
seq_1_id bigint DEFAULT '0' NOT NULL,
 
423
PRIMARY KEY (seq_0_id,seq_1_id)
 
424
);
 
425
INSERT INTO t6 VALUES (1,1);
 
426
INSERT INTO t6 VALUES (1,2);
 
427
INSERT INTO t6 VALUES (2,2);
 
428
CREATE TABLE t7 (
 
429
t7_id bigint NOT NULL auto_increment,
 
430
_field_143 int,
 
431
_field_165 varchar(32),
 
432
_field_166 int DEFAULT '0' NOT NULL,
 
433
PRIMARY KEY (t7_id),
 
434
KEY _field_166 (_field_166)
 
435
);
 
436
INSERT INTO t7 VALUES (1,0,'High',1);
 
437
INSERT INTO t7 VALUES (2,0,'Medium',2);
 
438
INSERT INTO t7 VALUES (3,0,'Low',3);
 
439
select replace(t3._field_140, "\r","^M"),t3_id,min(t3._field_131), min(t3._field_135), min(t3._field_139), min(t3._field_137), min(link_alias_142._field_165), min(link_alias_133._field_72), min(t3._field_145), min(link_alias_148._field_156), replace(min(t3._field_140), "\r","^M"),t3.t3_id from t3 left join t4 on t4.seq_0_id = t3.t3_id left join t7 link_alias_142 on t4.seq_1_id = link_alias_142.t7_id left join t6 on t6.seq_0_id = t3.t3_id left join t1 link_alias_133 on t6.seq_1_id = link_alias_133.t1_id left join t2 on t2.seq_0_id = t3.t3_id left join t5 link_alias_148 on t2.seq_1_id = link_alias_148.t5_id where t3.t3_id in (1) group by t3.t3_id order by link_alias_142._field_166, _field_139, link_alias_133._field_72, _field_135, link_alias_148._field_156;
 
440
replace(t3._field_140, "\r","^M")       t3_id   min(t3._field_131)      min(t3._field_135)      min(t3._field_139)      min(t3._field_137)      min(link_alias_142._field_165)  min(link_alias_133._field_72)   min(t3._field_145)      min(link_alias_148._field_156)  replace(min(t3._field_140), "\r","^M")  t3_id
 
441
test^M
 
442
job^M
 
443
1       1       test job 1      NULL    1999-02-25 22:43:32     0       High    admin   0       tomato  test^M
 
444
job^M
 
445
1       1
 
446
drop table t1,t2,t3,t4,t5,t6,t7;
 
447
create table t1 (a blob);
 
448
insert into t1 values ("empty"),("");
 
449
select a,reverse(a) from t1;
 
450
a       reverse(a)
 
451
empty   ytpme
 
452
        
 
453
drop table t1;
 
454
create table t1 (a blob, key (a(10)));
 
455
insert into t1 values ("bye"),("hello"),("hello"),("hello word");
 
456
select * from t1 where a like "hello%";
 
457
a
 
458
hello
 
459
hello
 
460
hello word
 
461
drop table t1;
 
462
CREATE TABLE t1 (
 
463
f1 int DEFAULT '0' NOT NULL,
 
464
f2 varchar(16) DEFAULT '' NOT NULL,
 
465
f5 text,
 
466
KEY index_name (f1,f2,f5(16))
 
467
);
 
468
INSERT INTO t1 VALUES (0,'traktor','1111111111111');
 
469
INSERT INTO t1 VALUES (1,'traktor','1111111111111111111111111');
 
470
select count(*) from t1 where f2='traktor';
 
471
count(*)
 
472
2
 
473
drop table t1;
 
474
create table t1 (foobar tinyblob not null, boggle int not null, key (foobar(32), boggle));
 
475
insert into t1 values ('fish', 10),('bear', 20);
 
476
select foobar, boggle from t1 where foobar = 'fish';
 
477
foobar  boggle
 
478
fish    10
 
479
select foobar, boggle from t1 where foobar = 'fish' and boggle = 10;
 
480
foobar  boggle
 
481
fish    10
 
482
drop table t1;
 
483
create table t1 (id integer primary key auto_increment, txt text, index txt_index (txt (20)));
 
484
insert into t1 (txt) values ('Chevy'), ('Chevy '), (NULL);
 
485
select * from t1 where txt='Chevy' or txt is NULL;
 
486
id      txt
 
487
1       Chevy
 
488
2       Chevy 
 
489
3       NULL
 
490
explain select * from t1 where txt='Chevy' or txt is NULL;
 
491
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
 
492
1       SIMPLE  t1      ALL     txt_index       NULL    NULL    NULL    2       Using where
 
493
select * from t1 where txt='Chevy ';
 
494
id      txt
 
495
1       Chevy
 
496
2       Chevy 
 
497
select * from t1 where txt='Chevy ' or txt='Chevy';
 
498
id      txt
 
499
1       Chevy
 
500
2       Chevy 
 
501
select * from t1 where txt='Chevy' or txt='Chevy ';
 
502
id      txt
 
503
1       Chevy
 
504
2       Chevy 
 
505
select * from t1 where id='1' or id='2';
 
506
id      txt
 
507
1       Chevy
 
508
2       Chevy 
 
509
insert into t1 (txt) values('Ford');
 
510
select * from t1 where txt='Chevy' or txt='Chevy ' or txt='Ford';
 
511
id      txt
 
512
1       Chevy
 
513
2       Chevy 
 
514
4       Ford
 
515
select * from t1 where txt='Chevy' or txt='Chevy ';
 
516
id      txt
 
517
1       Chevy
 
518
2       Chevy 
 
519
select * from t1 where txt='Chevy' or txt='Chevy ' or txt=' Chevy';
 
520
id      txt
 
521
1       Chevy
 
522
2       Chevy 
 
523
select * from t1 where txt in ('Chevy ','Chevy');
 
524
id      txt
 
525
1       Chevy
 
526
2       Chevy 
 
527
select * from t1 where txt in ('Chevy');
 
528
id      txt
 
529
1       Chevy
 
530
2       Chevy 
 
531
select * from t1 where txt between 'Chevy' and 'Chevy';
 
532
id      txt
 
533
1       Chevy
 
534
2       Chevy 
 
535
select * from t1 where txt between 'Chevy' and 'Chevy' or txt='Chevy ';
 
536
id      txt
 
537
1       Chevy
 
538
2       Chevy 
 
539
select * from t1 where txt between 'Chevy' and 'Chevy ';
 
540
id      txt
 
541
1       Chevy
 
542
2       Chevy 
 
543
select * from t1 where txt < 'Chevy ';
 
544
id      txt
 
545
select * from t1 where txt < 'Chevy ' or txt is NULL;
 
546
id      txt
 
547
3       NULL
 
548
select * from t1 where txt <= 'Chevy';
 
549
id      txt
 
550
1       Chevy
 
551
2       Chevy 
 
552
select * from t1 where txt > 'Chevy';
 
553
id      txt
 
554
4       Ford
 
555
select * from t1 where txt >= 'Chevy';
 
556
id      txt
 
557
1       Chevy
 
558
2       Chevy 
 
559
4       Ford
 
560
alter table t1 modify column txt blob;
 
561
explain select * from t1 where txt='Chevy' or txt is NULL;
 
562
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
 
563
1       SIMPLE  t1      ALL     txt_index       NULL    NULL    NULL    2       Using where
 
564
select * from t1 where txt='Chevy' or txt is NULL;
 
565
id      txt
 
566
1       Chevy
 
567
3       NULL
 
568
explain select * from t1 where txt='Chevy' or txt is NULL order by txt;
 
569
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
 
570
1       SIMPLE  t1      ALL     txt_index       NULL    NULL    NULL    2       Using where; Using filesort
 
571
select * from t1 where txt='Chevy' or txt is NULL order by txt;
 
572
id      txt
 
573
3       NULL
 
574
1       Chevy
 
575
drop table t1;
 
576
CREATE TABLE t1 ( i int NOT NULL default '0',    c text NOT NULL, d varchar(1) NOT NULL DEFAULT ' ', PRIMARY KEY  (i), KEY (c(1),d));
 
577
INSERT t1 (i, c) VALUES (1,''),(2,''),(3,'asdfh'),(4,'');
 
578
select max(i) from t1 where c = '';
 
579
max(i)
 
580
4
 
581
drop table t1;
 
582
create table t1 (a int, b int, c tinyblob, d int, e int);
 
583
alter table t1 add primary key (a,b,c(255),d);
 
584
alter table t1 add key (a,b,d,e);
 
585
show create table t1;
 
586
Table   Create Table
 
587
t1      CREATE TABLE `t1` (
 
588
  `a` INT NOT NULL,
 
589
  `b` INT NOT NULL,
 
590
  `c` BLOB NOT NULL,
 
591
  `d` INT NOT NULL,
 
592
  `e` INT DEFAULT NULL,
 
593
  PRIMARY KEY (`a`,`b`,`c`(255),`d`) USING BTREE,
 
594
  KEY `a` (`a`,`b`,`d`,`e`) USING BTREE
 
595
) ENGINE=DEFAULT COLLATE = utf8_general_ci
 
596
drop table t1;
 
597
CREATE table t1 (a blob);
 
598
insert into t1 values ('b'),('a\0'),('a'),('a '),('aa'),(NULL);
 
599
select hex(a) from t1 order by a;
 
600
hex(a)
 
601
NULL
 
602
61
 
603
6100
 
604
6120
 
605
6161
 
606
62
 
607
select hex(concat(a,'\0')) as b from t1 order by concat(a,'\0');
 
608
b
 
609
NULL
 
610
6100
 
611
610000
 
612
612000
 
613
616100
 
614
6200
 
615
alter table t1 modify a blob;
 
616
select hex(a) from t1 order by a;
 
617
hex(a)
 
618
NULL
 
619
61
 
620
6100
 
621
6120
 
622
6161
 
623
62
 
624
select hex(concat(a,'\0')) as b from t1 order by concat(a,'\0');
 
625
b
 
626
NULL
 
627
6100
 
628
610000
 
629
612000
 
630
616100
 
631
6200
 
632
alter table t1 modify a char(5);
 
633
select hex(a) from t1 order by a;
 
634
hex(a)
 
635
NULL
 
636
6100
 
637
61
 
638
6120
 
639
6161
 
640
62
 
641
select hex(concat(a,'\0')) as b from t1 order by concat(a,'\0');
 
642
b
 
643
NULL
 
644
610000
 
645
6100
 
646
612000
 
647
616100
 
648
6200
 
649
drop table t1;
 
650
create table t1 (a text default '');
 
651
show create table t1;
 
652
Table   Create Table
 
653
t1      CREATE TABLE `t1` (
 
654
  `a` TEXT COLLATE utf8_general_ci DEFAULT ''
 
655
) ENGINE=DEFAULT COLLATE = utf8_general_ci
 
656
insert into t1 values (default);
 
657
select * from t1;
 
658
a
 
659
 
 
660
drop table t1;
 
661
create table t1 (a text default '');
 
662
drop table t1;
 
663
CREATE TABLE t (c TEXT);
 
664
INSERT INTO t (c) VALUES (REPEAT('1',65537));
 
665
INSERT INTO t (c) VALUES (REPEAT('2',65536));
 
666
INSERT INTO t (c) VALUES (REPEAT('3',65535));
 
667
SELECT LENGTH(c), CHAR_LENGTH(c) FROM t;
 
668
LENGTH(c)       CHAR_LENGTH(c)
 
669
65537   65537
 
670
65536   65536
 
671
65535   65535
 
672
DROP TABLE t;
 
673
End of 5.0 tests