~linuxjedi/drizzle/trunk-bug-667053

« back to all changes in this revision

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

  • Committer: brian
  • Date: 2008-06-25 05:29:13 UTC
  • Revision ID: brian@localhost.localdomain-20080625052913-6upwo0jsrl4lnapl
clean slate

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
select 0 + b'1';
 
2
0 + b'1'
 
3
1
 
4
select 0 + b'0';
 
5
0 + b'0'
 
6
0
 
7
select 0 + b'000001';
 
8
0 + b'000001'
 
9
1
 
10
select 0 + b'000011';
 
11
0 + b'000011'
 
12
3
 
13
select 0 + b'000101';
 
14
0 + b'000101'
 
15
5
 
16
select 0 + b'000000';
 
17
0 + b'000000'
 
18
0
 
19
select 0 + b'10000000';
 
20
0 + b'10000000'
 
21
128
 
22
select 0 + b'11111111';
 
23
0 + b'11111111'
 
24
255
 
25
select 0 + b'10000001';
 
26
0 + b'10000001'
 
27
129
 
28
select 0 + b'1000000000000000';
 
29
0 + b'1000000000000000'
 
30
32768
 
31
select 0 + b'1111111111111111';
 
32
0 + b'1111111111111111'
 
33
65535
 
34
select 0 + b'1000000000000001';
 
35
0 + b'1000000000000001'
 
36
32769
 
37
drop table if exists t1;
 
38
create table t1 (a bit(65)) engine=innodb;
 
39
ERROR 42000: Display width out of range for column 'a' (max = 64)
 
40
create table t1 (a bit(0)) engine=innodb;
 
41
show create table t1;
 
42
Table   Create Table
 
43
t1      CREATE TABLE `t1` (
 
44
  `a` bit(1) DEFAULT NULL
 
45
) ENGINE=InnoDB DEFAULT CHARSET=latin1
 
46
drop table t1;
 
47
create table t1 (a bit(64)) engine=innodb;
 
48
insert into t1 values 
 
49
(b'1111111111111111111111111111111111111111111111111111111111111111'),
 
50
(b'1000000000000000000000000000000000000000000000000000000000000000'),
 
51
(b'0000000000000000000000000000000000000000000000000000000000000001'),
 
52
(b'1010101010101010101010101010101010101010101010101010101010101010'),
 
53
(b'0101010101010101010101010101010101010101010101010101010101010101');
 
54
select hex(a) from t1;
 
55
hex(a)
 
56
FFFFFFFFFFFFFFFF
 
57
8000000000000000
 
58
1
 
59
AAAAAAAAAAAAAAAA
 
60
5555555555555555
 
61
drop table t1;
 
62
create table t1 (a bit) engine=innodb;
 
63
insert into t1 values (b'0'), (b'1'), (b'000'), (b'100'), (b'001');
 
64
Warnings:
 
65
Warning 1264    Out of range value for column 'a' at row 4
 
66
select hex(a) from t1;
 
67
hex(a)
 
68
0
 
69
1
 
70
0
 
71
1
 
72
1
 
73
alter table t1 add unique (a);
 
74
ERROR 23000: Duplicate entry '' for key 'a'
 
75
drop table t1;
 
76
create table t1 (a bit(2)) engine=innodb;
 
77
insert into t1 values (b'00'), (b'01'), (b'10'), (b'100');
 
78
Warnings:
 
79
Warning 1264    Out of range value for column 'a' at row 4
 
80
select a+0 from t1;
 
81
a+0
 
82
0
 
83
1
 
84
2
 
85
3
 
86
alter table t1 add key (a);
 
87
explain select a+0 from t1;
 
88
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
 
89
1       SIMPLE  t1      index   NULL    a       2       NULL    4       Using index
 
90
select a+0 from t1;
 
91
a+0
 
92
0
 
93
1
 
94
2
 
95
3
 
96
drop table t1;
 
97
create table t1 (a bit(7), b bit(9), key(a, b)) engine=innodb;
 
98
insert into t1 values 
 
99
(94, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),    
 
100
(75, 42), (108, 67), (79, 349), (59, 188), (68, 206), (49, 345), (118, 380),   
 
101
(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),    
 
102
(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),
 
103
(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),   
 
104
(44, 307), (68, 454), (57, 135);
 
105
explain select a+0 from t1;
 
106
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
 
107
1       SIMPLE  t1      index   NULL    a       5       NULL    38      Using index
 
108
select a+0 from t1;
 
109
a+0
 
110
0
 
111
4
 
112
5
 
113
9
 
114
23
 
115
24
 
116
28
 
117
29
 
118
30
 
119
31
 
120
34
 
121
44
 
122
49
 
123
56
 
124
57
 
125
59
 
126
60
 
127
61
 
128
68
 
129
68
 
130
75
 
131
77
 
132
78
 
133
79
 
134
87
 
135
88
 
136
94
 
137
94
 
138
104
 
139
106
 
140
108
 
141
111
 
142
116
 
143
118
 
144
119
 
145
122
 
146
123
 
147
127
 
148
explain select b+0 from t1;
 
149
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
 
150
1       SIMPLE  t1      index   NULL    a       5       NULL    38      Using index
 
151
select b+0 from t1;
 
152
b+0
 
153
177
 
154
245
 
155
178
 
156
363
 
157
36
 
158
398
 
159
499
 
160
399
 
161
83
 
162
438
 
163
202
 
164
307
 
165
345
 
166
379
 
167
135
 
168
188
 
169
343
 
170
152
 
171
206
 
172
454
 
173
42
 
174
133
 
175
123
 
176
349
 
177
351
 
178
411
 
179
46
 
180
468
 
181
280
 
182
446
 
183
67
 
184
368
 
185
390
 
186
380
 
187
368
 
188
118
 
189
411
 
190
403
 
191
explain select a+0, b+0 from t1;
 
192
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
 
193
1       SIMPLE  t1      index   NULL    a       5       NULL    38      Using index
 
194
select a+0, b+0 from t1;
 
195
a+0     b+0
 
196
0       177
 
197
4       245
 
198
5       178
 
199
9       363
 
200
23      36
 
201
24      398
 
202
28      499
 
203
29      399
 
204
30      83
 
205
31      438
 
206
34      202
 
207
44      307
 
208
49      345
 
209
56      379
 
210
57      135
 
211
59      188
 
212
60      343
 
213
61      152
 
214
68      206
 
215
68      454
 
216
75      42
 
217
77      133
 
218
78      123
 
219
79      349
 
220
87      351
 
221
88      411
 
222
94      46
 
223
94      468
 
224
104     280
 
225
106     446
 
226
108     67
 
227
111     368
 
228
116     390
 
229
118     380
 
230
119     368
 
231
122     118
 
232
123     411
 
233
127     403
 
234
explain select a+0, b+0 from t1 where a > 40 and b > 200 order by 1;
 
235
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
 
236
1       SIMPLE  t1      range   a       a       2       NULL    19      Using where; Using index; Using filesort
 
237
select a+0, b+0 from t1 where a > 40 and b > 200 order by 1;
 
238
a+0     b+0
 
239
44      307
 
240
49      345
 
241
56      379
 
242
60      343
 
243
68      206
 
244
68      454
 
245
79      349
 
246
87      351
 
247
88      411
 
248
94      468
 
249
104     280
 
250
106     446
 
251
111     368
 
252
116     390
 
253
118     380
 
254
119     368
 
255
123     411
 
256
127     403
 
257
explain select a+0, b+0 from t1 where a > 40 and a < 70 order by 2;
 
258
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
 
259
1       SIMPLE  t1      range   a       a       2       NULL    8       Using where; Using index; Using filesort
 
260
select a+0, b+0 from t1 where a > 40 and a < 70 order by 2;
 
261
a+0     b+0
 
262
57      135
 
263
61      152
 
264
59      188
 
265
68      206
 
266
44      307
 
267
60      343
 
268
49      345
 
269
56      379
 
270
68      454
 
271
set @@max_length_for_sort_data=0;
 
272
Warnings:
 
273
Warning 1292    Truncated incorrect max_length_for_sort_data value: '0'
 
274
select a+0, b+0 from t1 where a > 40 and a < 70 order by 2;
 
275
a+0     b+0
 
276
57      135
 
277
61      152
 
278
59      188
 
279
68      206
 
280
44      307
 
281
60      343
 
282
49      345
 
283
56      379
 
284
68      454
 
285
select hex(min(a)) from t1;
 
286
hex(min(a))
 
287
0
 
288
select hex(min(b)) from t1;
 
289
hex(min(b))
 
290
24
 
291
select hex(min(a)), hex(max(a)), hex(min(b)), hex(max(b)) from t1;
 
292
hex(min(a))     hex(max(a))     hex(min(b))     hex(max(b))
 
293
0       7F      24      1F3
 
294
drop table t1;
 
295
create table t1 (a int not null, b bit, c bit(9), key(a, b, c)) engine=innodb;
 
296
insert into t1 values
 
297
(4, NULL, 1), (4, 0, 3), (2, 1, 4), (1, 1, 100), (4, 0, 23), (4, 0, 54),
 
298
(56, 0, 22), (4, 1, 100), (23, 0, 1), (4, 0, 34);
 
299
select a+0, b+0, c+0 from t1;
 
300
a+0     b+0     c+0
 
301
1       1       100
 
302
2       1       4
 
303
4       NULL    1
 
304
4       0       3
 
305
4       0       23
 
306
4       0       34
 
307
4       0       54
 
308
4       1       100
 
309
23      0       1
 
310
56      0       22
 
311
select hex(min(b)) from t1 where a = 4;
 
312
hex(min(b))
 
313
0
 
314
select hex(min(c)) from t1 where a = 4 and b = 0;
 
315
hex(min(c))
 
316
3
 
317
select hex(max(b)) from t1;
 
318
hex(max(b))
 
319
1
 
320
select a+0, b+0, c+0 from t1 where a = 4 and b = 0 limit 2;
 
321
a+0     b+0     c+0
 
322
4       0       3
 
323
4       0       23
 
324
select a+0, b+0, c+0 from t1 where a = 4 and b = 1;
 
325
a+0     b+0     c+0
 
326
4       1       100
 
327
select a+0, b+0, c+0 from t1 where a = 4 and b = 1 and c=100;
 
328
a+0     b+0     c+0
 
329
4       1       100
 
330
select a+0, b+0, c+0 from t1 order by b desc;
 
331
a+0     b+0     c+0
 
332
2       1       4
 
333
1       1       100
 
334
4       1       100
 
335
4       0       3
 
336
4       0       23
 
337
4       0       54
 
338
56      0       22
 
339
23      0       1
 
340
4       0       34
 
341
4       NULL    1
 
342
select a+0, b+0, c+0 from t1 order by c;
 
343
a+0     b+0     c+0
 
344
4       NULL    1
 
345
23      0       1
 
346
4       0       3
 
347
2       1       4
 
348
56      0       22
 
349
4       0       23
 
350
4       0       34
 
351
4       0       54
 
352
1       1       100
 
353
4       1       100
 
354
drop table t1;
 
355
create table t1(a bit(2), b bit(2)) engine=innodb;
 
356
insert into t1 (a) values (0x01), (0x03), (0x02);
 
357
update t1 set b= concat(a);
 
358
select a+0, b+0 from t1;
 
359
a+0     b+0
 
360
1       1
 
361
3       3
 
362
2       2
 
363
drop table t1;
 
364
create table t1 (a bit(7), key(a)) engine=innodb;
 
365
insert into t1 values (44), (57);
 
366
select a+0 from t1;
 
367
a+0
 
368
44
 
369
57
 
370
drop table t1;
 
371
create table t1 (a bit(3), b bit(12)) engine=innodb;
 
372
insert into t1 values (7,(1<<12)-2), (0x01,0x01ff);
 
373
select hex(a),hex(b) from t1;
 
374
hex(a)  hex(b)
 
375
7       FFE
 
376
1       1FF
 
377
select hex(concat(a)),hex(concat(b)) from t1;
 
378
hex(concat(a))  hex(concat(b))
 
379
07      0FFE
 
380
01      01FF
 
381
drop table t1;
 
382
create table t1(a int, b bit not null) engine=innodb;
 
383
alter table t1 add primary key (a);
 
384
drop table t1;
 
385
create table t1 (a bit, b bit(10)) engine=innodb;
 
386
show create table t1;
 
387
Table   Create Table
 
388
t1      CREATE TABLE `t1` (
 
389
  `a` bit(1) DEFAULT NULL,
 
390
  `b` bit(10) DEFAULT NULL
 
391
) ENGINE=InnoDB DEFAULT CHARSET=latin1
 
392
alter table t1 engine=heap;
 
393
show create table t1;
 
394
Table   Create Table
 
395
t1      CREATE TABLE `t1` (
 
396
  `a` bit(1) DEFAULT NULL,
 
397
  `b` bit(10) DEFAULT NULL
 
398
) ENGINE=MEMORY DEFAULT CHARSET=latin1
 
399
alter table t1 engine=innodb;
 
400
show create table t1;
 
401
Table   Create Table
 
402
t1      CREATE TABLE `t1` (
 
403
  `a` bit(1) DEFAULT NULL,
 
404
  `b` bit(10) DEFAULT NULL
 
405
) ENGINE=InnoDB DEFAULT CHARSET=latin1
 
406
drop table t1;
 
407
create table t1 (a bit(7)) engine=innodb;
 
408
insert into t1 values (0x60);
 
409
select * from t1;
 
410
Catalog Database        Table   Table_alias     Column  Column_alias    Type    Length  Max length      Is_null Flags   Decimals        Charsetnr
 
411
def     test    t1      t1      a       a       16      7       1       Y       32      0       63
 
412
a
 
413
`
 
414
drop table t1;
 
415
End of 5.0 tests