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

« back to all changes in this revision

Viewing changes to tests/r/pbxt/type_varchar.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;
 
2
create table t1 (v varchar(30), c char(3), e enum('abc','def','ghi'), t text);
 
3
show create table t1;
 
4
Table   Create Table
 
5
t1      CREATE TABLE `t1` (
 
6
  `v` VARCHAR(30) COLLATE utf8_general_ci DEFAULT NULL,
 
7
  `c` VARCHAR(3) COLLATE utf8_general_ci DEFAULT NULL,
 
8
  `e` ENUM('abc','def','ghi') DEFAULT NULL,
 
9
  `t` TEXT COLLATE utf8_general_ci
 
10
) ENGINE=DEFAULT COLLATE = utf8_general_ci
 
11
insert into t1 values ('abc', 'de', 'ghi', 'jkl');
 
12
insert into t1 values ('abc ', 'de ', 'ghi', 'jkl ');
 
13
insert into t1 values ('abc    ', 'd  ', 'ghi', 'jkl    ');
 
14
select length(v),length(c),length(e),length(t) from t1;
 
15
length(v)       length(c)       length(e)       length(t)
 
16
3       2       3       3
 
17
4       3       3       4
 
18
7       3       3       7
 
19
drop table t1;
 
20
create table t1 (v varchar(20));
 
21
insert into t1 values('a ');
 
22
select v='a' from t1;
 
23
v='a'
 
24
1
 
25
select binary v='a' from t1;
 
26
binary v='a'
 
27
0
 
28
select binary v='a ' from t1;
 
29
binary v='a '
 
30
1
 
31
insert into t1 values('a');
 
32
alter table t1 add primary key (v);
 
33
ERROR 23000: Duplicate entry 'a' for key 'PRIMARY'
 
34
drop table t1;
 
35
create table t1 (v varbinary(20));
 
36
insert into t1 values('a');
 
37
insert into t1 values('a ');
 
38
alter table t1 add primary key (v);
 
39
drop table t1;
 
40
create table t1 (v varchar(254), index (v));
 
41
insert into t1 values ("This is a test ");
 
42
insert into t1 values ("Some sample data");
 
43
insert into t1 values (" garbage ");
 
44
insert into t1 values (" This is a test ");
 
45
insert into t1 values ("This is a test");
 
46
insert into t1 values ("Hello world");
 
47
insert into t1 values ("Foo bar");
 
48
insert into t1 values ("This is a test");
 
49
insert into t1 values ("MySQL varchar test");
 
50
insert into t1 values ("test MySQL varchar");
 
51
insert into t1 values ("This is a long string to have some random length data included");
 
52
insert into t1 values ("Short string");
 
53
insert into t1 values ("VSS");
 
54
insert into t1 values ("Some samples");
 
55
insert into t1 values ("Bar foo");
 
56
insert into t1 values ("Bye");
 
57
select * from t1 where v like 'This is a test' order by v;
 
58
v
 
59
This is a test
 
60
This is a test
 
61
select * from t1 where v='This is a test' order by v;
 
62
v
 
63
This is a test 
 
64
This is a test
 
65
This is a test
 
66
select * from t1 where v like 'S%' order by v;
 
67
v
 
68
Short string
 
69
Some sample data
 
70
Some samples
 
71
explain select * from t1 where v like 'This is a test' order by v;
 
72
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
 
73
1       SIMPLE  t1      ALL     v       NULL    NULL    NULL    16      Using where; Using filesort
 
74
explain select * from t1 where v='This is a test' order by v;
 
75
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
 
76
1       SIMPLE  t1      ref     v       v       1019    const   1       Using where
 
77
explain select * from t1 where v like 'S%' order by v;
 
78
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
 
79
1       SIMPLE  t1      ALL     v       NULL    NULL    NULL    16      Using where; Using filesort
 
80
alter table t1 change v v varchar(255);
 
81
select * from t1 where v like 'This is a test' order by v;
 
82
v
 
83
This is a test
 
84
This is a test
 
85
select * from t1 where v='This is a test' order by v;
 
86
v
 
87
This is a test 
 
88
This is a test
 
89
This is a test
 
90
select * from t1 where v like 'S%' order by v;
 
91
v
 
92
Short string
 
93
Some sample data
 
94
Some samples
 
95
explain select * from t1 where v like 'This is a test' order by v;
 
96
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
 
97
1       SIMPLE  t1      ALL     v       NULL    NULL    NULL    16      Using where; Using filesort
 
98
explain select * from t1 where v='This is a test' order by v;
 
99
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
 
100
1       SIMPLE  t1      ref     v       v       1023    const   1       Using where
 
101
explain select * from t1 where v like 'S%' order by v;
 
102
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
 
103
1       SIMPLE  t1      ALL     v       NULL    NULL    NULL    16      Using where; Using filesort
 
104
alter table t1 change v v varchar(256);
 
105
select * from t1 where v like 'This is a test' order by v;
 
106
v
 
107
This is a test
 
108
This is a test
 
109
select * from t1 where v='This is a test' order by v;
 
110
v
 
111
This is a test 
 
112
This is a test
 
113
This is a test
 
114
select * from t1 where v like 'S%' order by v;
 
115
v
 
116
Short string
 
117
Some sample data
 
118
Some samples
 
119
explain select * from t1 where v like 'This is a test' order by v;
 
120
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
 
121
1       SIMPLE  t1      ALL     v       NULL    NULL    NULL    16      Using where; Using filesort
 
122
explain select * from t1 where v='This is a test' order by v;
 
123
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
 
124
1       SIMPLE  t1      ref     v       v       1027    const   1       Using where
 
125
explain select * from t1 where v like 'S%' order by v;
 
126
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
 
127
1       SIMPLE  t1      ALL     v       NULL    NULL    NULL    16      Using where; Using filesort
 
128
alter table t1 change v v varchar(257);
 
129
select * from t1 where v like 'This is a test' order by v;
 
130
v
 
131
This is a test
 
132
This is a test
 
133
select * from t1 where v='This is a test' order by v;
 
134
v
 
135
This is a test 
 
136
This is a test
 
137
This is a test
 
138
select * from t1 where v like 'S%' order by v;
 
139
v
 
140
Short string
 
141
Some sample data
 
142
Some samples
 
143
explain select * from t1 where v like 'This is a test' order by v;
 
144
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
 
145
1       SIMPLE  t1      ALL     v       NULL    NULL    NULL    16      Using where; Using filesort
 
146
explain select * from t1 where v='This is a test' order by v;
 
147
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
 
148
1       SIMPLE  t1      ref     v       v       1031    const   1       Using where
 
149
explain select * from t1 where v like 'S%' order by v;
 
150
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
 
151
1       SIMPLE  t1      ALL     v       NULL    NULL    NULL    16      Using where; Using filesort
 
152
alter table t1 change v v varchar(258);
 
153
select * from t1 where v like 'This is a test' order by v;
 
154
v
 
155
This is a test
 
156
This is a test
 
157
select * from t1 where v='This is a test' order by v;
 
158
v
 
159
This is a test 
 
160
This is a test
 
161
This is a test
 
162
select * from t1 where v like 'S%' order by v;
 
163
v
 
164
Short string
 
165
Some sample data
 
166
Some samples
 
167
explain select * from t1 where v like 'This is a test' order by v;
 
168
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
 
169
1       SIMPLE  t1      ALL     v       NULL    NULL    NULL    16      Using where; Using filesort
 
170
explain select * from t1 where v='This is a test' order by v;
 
171
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
 
172
1       SIMPLE  t1      ref     v       v       1035    const   1       Using where
 
173
explain select * from t1 where v like 'S%' order by v;
 
174
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
 
175
1       SIMPLE  t1      ALL     v       NULL    NULL    NULL    16      Using where; Using filesort
 
176
alter table t1 change v v varchar(259);
 
177
select * from t1 where v like 'This is a test' order by v;
 
178
v
 
179
This is a test
 
180
This is a test
 
181
select * from t1 where v='This is a test' order by v;
 
182
v
 
183
This is a test 
 
184
This is a test
 
185
This is a test
 
186
select * from t1 where v like 'S%' order by v;
 
187
v
 
188
Short string
 
189
Some sample data
 
190
Some samples
 
191
explain select * from t1 where v like 'This is a test' order by v;
 
192
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
 
193
1       SIMPLE  t1      ALL     v       NULL    NULL    NULL    16      Using where; Using filesort
 
194
explain select * from t1 where v='This is a test' order by v;
 
195
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
 
196
1       SIMPLE  t1      ref     v       v       1039    const   1       Using where
 
197
explain select * from t1 where v like 'S%' order by v;
 
198
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
 
199
1       SIMPLE  t1      ALL     v       NULL    NULL    NULL    16      Using where; Using filesort
 
200
alter table t1 change v v varchar(258);
 
201
select * from t1 where v like 'This is a test' order by v;
 
202
v
 
203
This is a test
 
204
This is a test
 
205
select * from t1 where v='This is a test' order by v;
 
206
v
 
207
This is a test 
 
208
This is a test
 
209
This is a test
 
210
select * from t1 where v like 'S%' order by v;
 
211
v
 
212
Short string
 
213
Some sample data
 
214
Some samples
 
215
explain select * from t1 where v like 'This is a test' order by v;
 
216
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
 
217
1       SIMPLE  t1      ALL     v       NULL    NULL    NULL    16      Using where; Using filesort
 
218
explain select * from t1 where v='This is a test' order by v;
 
219
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
 
220
1       SIMPLE  t1      ref     v       v       1035    const   1       Using where
 
221
explain select * from t1 where v like 'S%' order by v;
 
222
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
 
223
1       SIMPLE  t1      ALL     v       NULL    NULL    NULL    16      Using where; Using filesort
 
224
alter table t1 change v v varchar(257);
 
225
select * from t1 where v like 'This is a test' order by v;
 
226
v
 
227
This is a test
 
228
This is a test
 
229
select * from t1 where v='This is a test' order by v;
 
230
v
 
231
This is a test 
 
232
This is a test
 
233
This is a test
 
234
select * from t1 where v like 'S%' order by v;
 
235
v
 
236
Short string
 
237
Some sample data
 
238
Some samples
 
239
explain select * from t1 where v like 'This is a test' order by v;
 
240
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
 
241
1       SIMPLE  t1      ALL     v       NULL    NULL    NULL    16      Using where; Using filesort
 
242
explain select * from t1 where v='This is a test' order by v;
 
243
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
 
244
1       SIMPLE  t1      ref     v       v       1031    const   1       Using where
 
245
explain select * from t1 where v like 'S%' order by v;
 
246
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
 
247
1       SIMPLE  t1      ALL     v       NULL    NULL    NULL    16      Using where; Using filesort
 
248
alter table t1 change v v varchar(256);
 
249
select * from t1 where v like 'This is a test' order by v;
 
250
v
 
251
This is a test
 
252
This is a test
 
253
select * from t1 where v='This is a test' order by v;
 
254
v
 
255
This is a test 
 
256
This is a test
 
257
This is a test
 
258
select * from t1 where v like 'S%' order by v;
 
259
v
 
260
Short string
 
261
Some sample data
 
262
Some samples
 
263
explain select * from t1 where v like 'This is a test' order by v;
 
264
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
 
265
1       SIMPLE  t1      ALL     v       NULL    NULL    NULL    16      Using where; Using filesort
 
266
explain select * from t1 where v='This is a test' order by v;
 
267
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
 
268
1       SIMPLE  t1      ref     v       v       1027    const   1       Using where
 
269
explain select * from t1 where v like 'S%' order by v;
 
270
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
 
271
1       SIMPLE  t1      ALL     v       NULL    NULL    NULL    16      Using where; Using filesort
 
272
alter table t1 change v v varchar(255);
 
273
select * from t1 where v like 'This is a test' order by v;
 
274
v
 
275
This is a test
 
276
This is a test
 
277
select * from t1 where v='This is a test' order by v;
 
278
v
 
279
This is a test 
 
280
This is a test
 
281
This is a test
 
282
select * from t1 where v like 'S%' order by v;
 
283
v
 
284
Short string
 
285
Some sample data
 
286
Some samples
 
287
explain select * from t1 where v like 'This is a test' order by v;
 
288
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
 
289
1       SIMPLE  t1      ALL     v       NULL    NULL    NULL    16      Using where; Using filesort
 
290
explain select * from t1 where v='This is a test' order by v;
 
291
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
 
292
1       SIMPLE  t1      ref     v       v       1023    const   1       Using where
 
293
explain select * from t1 where v like 'S%' order by v;
 
294
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
 
295
1       SIMPLE  t1      ALL     v       NULL    NULL    NULL    16      Using where; Using filesort
 
296
alter table t1 change v v varchar(254);
 
297
select * from t1 where v like 'This is a test' order by v;
 
298
v
 
299
This is a test
 
300
This is a test
 
301
select * from t1 where v='This is a test' order by v;
 
302
v
 
303
This is a test 
 
304
This is a test
 
305
This is a test
 
306
select * from t1 where v like 'S%' order by v;
 
307
v
 
308
Short string
 
309
Some sample data
 
310
Some samples
 
311
explain select * from t1 where v like 'This is a test' order by v;
 
312
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
 
313
1       SIMPLE  t1      ALL     v       NULL    NULL    NULL    16      Using where; Using filesort
 
314
explain select * from t1 where v='This is a test' order by v;
 
315
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
 
316
1       SIMPLE  t1      ref     v       v       1019    const   1       Using where
 
317
explain select * from t1 where v like 'S%' order by v;
 
318
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
 
319
1       SIMPLE  t1      ALL     v       NULL    NULL    NULL    16      Using where; Using filesort
 
320
alter table t1 change v v varchar(253);
 
321
alter table t1 change v v varchar(254), drop key v;
 
322
alter table t1 change v v varchar(300), add key (v(10));
 
323
select * from t1 where v like 'This is a test' order by v;
 
324
v
 
325
This is a test
 
326
This is a test
 
327
select * from t1 where v='This is a test' order by v;
 
328
v
 
329
This is a test 
 
330
This is a test
 
331
This is a test
 
332
Warnings:
 
333
Error   1406    Data too long for column 'v' at row 1
 
334
select * from t1 where v like 'S%' order by v;
 
335
v
 
336
Short string
 
337
Some sample data
 
338
Some samples
 
339
explain select * from t1 where v like 'This is a test' order by v;
 
340
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
 
341
1       SIMPLE  t1      ALL     v       NULL    NULL    NULL    16      Using where; Using filesort
 
342
explain select * from t1 where v='This is a test' order by v;
 
343
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
 
344
1       SIMPLE  t1      ref     v       v       43      const   1       Using where
 
345
Warnings:
 
346
Error   1406    Data too long for column 'v' at row 1
 
347
explain select * from t1 where v like 'S%' order by v;
 
348
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
 
349
1       SIMPLE  t1      ALL     v       NULL    NULL    NULL    16      Using where; Using filesort
 
350
drop table t1;
 
351
create table t1 (pkcol varchar(16), othercol varchar(16), primary key (pkcol));
 
352
insert into t1 values ('test', 'something');
 
353
update t1 set othercol='somethingelse' where pkcol='test';
 
354
select * from t1;
 
355
pkcol   othercol
 
356
test    somethingelse
 
357
drop table t1;
 
358
create table t1 (a int, b varchar(12));
 
359
insert into t1 values (1, 'A'), (22, NULL);
 
360
create table t2 (a int);
 
361
insert into t2 values (22), (22);
 
362
select t1.a, t1.b, min(t1.b) from t1 inner join t2 ON t2.a = t1.a 
 
363
group by t1.b, t1.a;
 
364
a       b       min(t1.b)
 
365
22      NULL    NULL
 
366
drop table t1, t2;
 
367
create table t1 (f1 varchar(6500));
 
368
create index index1 on t1(f1(10));
 
369
show create table t1;
 
370
Table   Create Table
 
371
t1      CREATE TABLE `t1` (
 
372
  `f1` VARCHAR(6500) COLLATE utf8_general_ci DEFAULT NULL,
 
373
  KEY `index1` (`f1`(10))
 
374
) ENGINE=DEFAULT COLLATE = utf8_general_ci
 
375
alter table t1 modify f1 varchar(255);
 
376
show create table t1;
 
377
Table   Create Table
 
378
t1      CREATE TABLE `t1` (
 
379
  `f1` VARCHAR(255) COLLATE utf8_general_ci DEFAULT NULL,
 
380
  KEY `index1` (`f1`(10))
 
381
) ENGINE=DEFAULT COLLATE = utf8_general_ci
 
382
alter table t1 modify f1 tinytext;
 
383
show create table t1;
 
384
Table   Create Table
 
385
t1      CREATE TABLE `t1` (
 
386
  `f1` TEXT COLLATE utf8_general_ci,
 
387
  KEY `index1` (`f1`(10))
 
388
) ENGINE=DEFAULT COLLATE = utf8_general_ci
 
389
drop table t1;
 
390
DROP TABLE IF EXISTS t1;
 
391
CREATE TABLE t1(f1 VARCHAR(100) DEFAULT 'test');
 
392
INSERT INTO t1 VALUES(SUBSTR(f1, 1, 3));
 
393
DROP TABLE IF EXISTS t1;
 
394
CREATE TABLE t1(f1 CHAR(100) DEFAULT 'test');
 
395
INSERT INTO t1 VALUES(SUBSTR(f1, 1, 3));
 
396
DROP TABLE IF EXISTS t1;
 
397
drop table if exists t1, t2, t3;
 
398
create table t3 (
 
399
id int,
 
400
en varchar(255),
 
401
cz varchar(255)
 
402
);
 
403
insert into t3 (id, en, cz) values 
 
404
(1,'en string 1','cz string 1'),
 
405
(2,'en string 2','cz string 2'),
 
406
(3,'en string 3','cz string 3');
 
407
create table t1 ( 
 
408
id int,
 
409
name_id int
 
410
);
 
411
insert into t1 (id, name_id) values (1,1), (2,3), (3,3);
 
412
create table t2 (id int);
 
413
insert into t2 (id) values (1), (2), (3);
 
414
select t1.*, t2.id, t3.en, t3.cz from t1 left join t2 on t1.id=t2.id
 
415
left join t3 on t1.id=t3.id order by t3.id;
 
416
Catalog Database        Table   Table_alias     Column  Column_alias    Type    Length  Max length      Is_null Flags   Decimals        Charsetnr
 
417
def     test    t1      t1      id      id      1       11      1       Y       32768   0       63
 
418
def     test    t1      t1      name_id name_id 1       11      1       Y       32768   0       63
 
419
def     test    t2      t2      id      id      1       11      1       Y       32768   0       63
 
420
def     test    t3      t3      en      en      8       1020    11      Y       0       0       45
 
421
def     test    t3      t3      cz      cz      8       1020    11      Y       0       0       45
 
422
id      name_id id      en      cz
 
423
1       1       1       en string 1     cz string 1
 
424
2       3       2       en string 2     cz string 2
 
425
3       3       3       en string 3     cz string 3
 
426
drop table t1, t2, t3;
 
427
CREATE TABLE t1 (a varchar(2));
 
428
INSERT INTO t1 VALUES (10), (50), (30), ('1a'), (60), ('t');
 
429
SELECT a,(a + 0) FROM t1 ORDER BY a;
 
430
a       (a + 0)
 
431
10      10
 
432
1a      1
 
433
30      30
 
434
50      50
 
435
60      60
 
436
t       0
 
437
SELECT a,(a DIV 2) FROM t1 ORDER BY a;
 
438
a       (a DIV 2)
 
439
10      5
 
440
1a      0
 
441
30      15
 
442
50      25
 
443
60      30
 
444
t       0
 
445
DROP TABLE t1;