File: bool.result

package info (click to toggle)
mariadb 1%3A11.8.3-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 772,520 kB
  • sloc: ansic: 2,414,714; cpp: 1,791,394; asm: 381,336; perl: 62,905; sh: 49,647; pascal: 40,897; java: 39,363; python: 20,791; yacc: 20,432; sql: 17,907; xml: 12,344; ruby: 8,544; cs: 6,542; makefile: 6,145; ada: 1,879; lex: 1,193; javascript: 996; objc: 80; tcl: 73; awk: 46; php: 22
file content (341 lines) | stat: -rw-r--r-- 7,366 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
DROP TABLE IF EXISTS t1;
SELECT IF(NULL AND 1, 1, 2), IF(1 AND NULL, 1, 2);
IF(NULL AND 1, 1, 2)	IF(1 AND NULL, 1, 2)
2	2
SELECT NULL AND 1, 1 AND NULL, 0 AND NULL, NULL and 0;
NULL AND 1	1 AND NULL	0 AND NULL	NULL and 0
NULL	NULL	0	0
create table t1 (a int);
insert into t1 values (0),(1),(NULL);
SELECT * FROM t1 WHERE IF(a AND 1, 0, 1);
a
0
NULL
SELECT * FROM t1 WHERE IF(1 AND a, 0, 1);
a
0
NULL
SELECT * FROM t1 where NOT(a AND 1);
a
0
SELECT * FROM t1 where NOT(1 AND a);
a
0
SELECT * FROM t1 where (a AND 1)=0;
a
0
SELECT * FROM t1 where (1 AND a)=0;
a
0
SELECT * FROM t1 where (1 AND a)=1;
a
1
SELECT * FROM t1 where (1 AND a) IS NULL;
a
NULL
set sql_mode='high_not_precedence';
select * from t1 where not a between 2 and 3;
a
set sql_mode=default;
select * from t1 where not a between 2 and 3;
a
0
1
select a, a is false, a is true, a is unknown from t1;
a	a is false	a is true	a is unknown
0	1	0	0
1	0	1	0
NULL	0	0	1
select a, a is not false, a is not true, a is not unknown from t1;
a	a is not false	a is not true	a is not unknown
0	0	1	1
1	1	0	1
NULL	1	1	0
SET @a=0, @b=0;
SELECT * FROM t1 WHERE NULL AND (@a:=@a+1);
a
SELECT * FROM t1 WHERE NOT(a>=0 AND NULL AND (@b:=@b+1));
a
SELECT * FROM t1 WHERE a=2 OR (NULL AND (@a:=@a+1));
a
SELECT * FROM t1 WHERE NOT(a=2 OR (NULL AND (@b:=@b+1)));
a
DROP TABLE t1;
create table t1 (a int, b int);
insert into t1 values(null, null), (0, null), (1, null), (null, 0), (null, 1), (0, 0), (0, 1), (1, 0), (1, 1);
select ifnull(A, 'N') as A, ifnull(B, 'N') as B, ifnull(not A, 'N') as nA, ifnull(not B, 'N') as nB, ifnull(A and B, 'N') as AB, ifnull(not (A and B), 'N') as `n(AB)`, ifnull((not A or not B), 'N') as nAonB, ifnull(A or B, 'N') as AoB, ifnull(not(A or B), 'N') as `n(AoB)`, ifnull(not A and not B, 'N') as nAnB from t1;
A	B	nA	nB	AB	n(AB)	nAonB	AoB	n(AoB)	nAnB
N	N	N	N	N	N	N	N	N	N
0	N	1	N	0	1	1	N	N	N
1	N	0	N	N	N	N	1	0	0
N	0	N	1	0	1	1	N	N	N
N	1	N	0	N	N	N	1	0	0
0	0	1	1	0	1	1	0	1	1
0	1	1	0	0	1	1	1	0	0
1	0	0	1	0	1	1	1	0	0
1	1	0	0	1	0	0	1	0	0
select ifnull(A=1, 'N') as A, ifnull(B=1, 'N') as B, ifnull(not (A=1), 'N') as nA, ifnull(not (B=1), 'N') as nB, ifnull((A=1) and (B=1), 'N') as AB, ifnull(not ((A=1) and (B=1)), 'N') as `n(AB)`, ifnull((not (A=1) or not (B=1)), 'N') as nAonB, ifnull((A=1) or (B=1), 'N') as AoB, ifnull(not((A=1) or (B=1)), 'N') as `n(AoB)`, ifnull(not (A=1) and not (B=1), 'N') as nAnB from t1;
A	B	nA	nB	AB	n(AB)	nAonB	AoB	n(AoB)	nAnB
N	N	N	N	N	N	N	N	N	N
0	N	1	N	0	1	1	N	N	N
1	N	0	N	N	N	N	1	0	0
N	0	N	1	0	1	1	N	N	N
N	1	N	0	N	N	N	1	0	0
0	0	1	1	0	1	1	0	1	1
0	1	1	0	0	1	1	1	0	0
1	0	0	1	0	1	1	1	0	0
1	1	0	0	1	0	0	1	0	0
drop table t1;
# Start of 10.6 tests
#
# MDEV-34189 Unexpected error on `WHERE inet6col`
#
CREATE TABLE t1 (id INT NOT NULL PRIMARY KEY, a INT, KEY(a));
INSERT INTO t1 VALUES (-1,NULL);
INSERT INTO t1 SELECT seq,seq FROM seq_0_to_31;
EXPLAIN EXTENDED
SELECT id, a FROM t1 WHERE a;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	t1	ALL	a	NULL	NULL	NULL	33	96.97	Using where
Warnings:
Note	1003	select `test`.`t1`.`id` AS `id`,`test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` is true
SELECT id, a FROM t1 WHERE a;
id	a
1	1
2	2
3	3
4	4
5	5
6	6
7	7
8	8
9	9
10	10
11	11
12	12
13	13
14	14
15	15
16	16
17	17
18	18
19	19
20	20
21	21
22	22
23	23
24	24
25	25
26	26
27	27
28	28
29	29
30	30
31	31
EXPLAIN EXTENDED
SELECT id, a FROM t1 WHERE NOT a;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	t1	range	a	a	5	NULL	1	100.00	Using index condition
Warnings:
Note	1003	select `test`.`t1`.`id` AS `id`,`test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` is false
SELECT id, a FROM t1 WHERE NOT a;
id	a
0	0
EXPLAIN EXTENDED
SELECT id, a FROM t1 WHERE a IS TRUE;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	t1	ALL	a	NULL	NULL	NULL	33	96.97	Using where
Warnings:
Note	1003	select `test`.`t1`.`id` AS `id`,`test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` is true
SELECT id, a FROM t1 WHERE a IS TRUE;
id	a
1	1
2	2
3	3
4	4
5	5
6	6
7	7
8	8
9	9
10	10
11	11
12	12
13	13
14	14
15	15
16	16
17	17
18	18
19	19
20	20
21	21
22	22
23	23
24	24
25	25
26	26
27	27
28	28
29	29
30	30
31	31
EXPLAIN EXTENDED
SELECT id, a FROM t1 WHERE NOT a IS TRUE;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	t1	range	a	a	5	NULL	2	100.00	Using index condition
Warnings:
Note	1003	select `test`.`t1`.`id` AS `id`,`test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` is not true
SELECT id, a FROM t1 WHERE NOT a IS TRUE;
id	a
-1	NULL
0	0
EXPLAIN EXTENDED
SELECT id, a FROM t1 WHERE a IS NOT TRUE;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	t1	range	a	a	5	NULL	2	100.00	Using index condition
Warnings:
Note	1003	select `test`.`t1`.`id` AS `id`,`test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` is not true
SELECT id, a FROM t1 WHERE a IS NOT TRUE;
id	a
-1	NULL
0	0
EXPLAIN EXTENDED
SELECT id, a FROM t1 WHERE NOT a IS NOT TRUE;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	t1	ALL	a	NULL	NULL	NULL	33	96.97	Using where
Warnings:
Note	1003	select `test`.`t1`.`id` AS `id`,`test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` is true
SELECT id, a FROM t1 WHERE NOT a IS NOT TRUE;
id	a
1	1
2	2
3	3
4	4
5	5
6	6
7	7
8	8
9	9
10	10
11	11
12	12
13	13
14	14
15	15
16	16
17	17
18	18
19	19
20	20
21	21
22	22
23	23
24	24
25	25
26	26
27	27
28	28
29	29
30	30
31	31
EXPLAIN EXTENDED
SELECT id, a FROM t1 WHERE a IS FALSE;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	t1	range	a	a	5	NULL	1	100.00	Using index condition
Warnings:
Note	1003	select `test`.`t1`.`id` AS `id`,`test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` is false
SELECT id, a FROM t1 WHERE a IS FALSE;
id	a
0	0
EXPLAIN EXTENDED
SELECT id, a FROM t1 WHERE NOT a IS FALSE;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	t1	ALL	a	NULL	NULL	NULL	33	96.97	Using where
Warnings:
Note	1003	select `test`.`t1`.`id` AS `id`,`test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` is not false
SELECT id, a FROM t1 WHERE NOT a IS FALSE;
id	a
-1	NULL
1	1
2	2
3	3
4	4
5	5
6	6
7	7
8	8
9	9
10	10
11	11
12	12
13	13
14	14
15	15
16	16
17	17
18	18
19	19
20	20
21	21
22	22
23	23
24	24
25	25
26	26
27	27
28	28
29	29
30	30
31	31
EXPLAIN EXTENDED
SELECT id, a FROM t1 WHERE a IS NOT FALSE;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	t1	ALL	a	NULL	NULL	NULL	33	96.97	Using where
Warnings:
Note	1003	select `test`.`t1`.`id` AS `id`,`test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` is not false
SELECT id, a FROM t1 WHERE a IS NOT FALSE;
id	a
-1	NULL
1	1
2	2
3	3
4	4
5	5
6	6
7	7
8	8
9	9
10	10
11	11
12	12
13	13
14	14
15	15
16	16
17	17
18	18
19	19
20	20
21	21
22	22
23	23
24	24
25	25
26	26
27	27
28	28
29	29
30	30
31	31
EXPLAIN EXTENDED
SELECT id, a FROM t1 WHERE NOT a IS NOT FALSE;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	t1	range	a	a	5	NULL	1	100.00	Using index condition
Warnings:
Note	1003	select `test`.`t1`.`id` AS `id`,`test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` is false
SELECT id, a FROM t1 WHERE NOT a IS NOT FALSE;
id	a
0	0
DROP TABLE t1;
# End of 10.6 tests