Skip to content

Commit 201c1e0

Browse files
author
Alexey Botchkov
committed
MDEV-9143 JSON_xxx functions.
Item_bool fixed to behave smarter with NOT operation.
1 parent b09b316 commit 201c1e0

File tree

4 files changed

+11
-2
lines changed

4 files changed

+11
-2
lines changed

mysql-test/r/null.result

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1584,7 +1584,7 @@ SELECT * FROM t1 WHERE ((c1 IS NOT NULL) >= (NOT TRUE)) IS NOT NULL;
15841584
id select_type table type possible_keys key key_len ref rows filtered Extra
15851585
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where
15861586
Warnings:
1587-
Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where (((`test`.`t1`.`c1` is not null) >= <cache>((not(1)))) is not null)
1587+
Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where (((`test`.`t1`.`c1` is not null) >= 0) is not null)
15881588
SELECT * FROM t1 WHERE ((c1 IS NOT NULL) >= (NOT TRUE)) IS NOT NULL;
15891589
c1
15901590
1

mysql-test/r/parser_precedence.result

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,7 @@ select (NOT FALSE) AND FALSE, NOT (FALSE AND FALSE), NOT FALSE AND FALSE;
369369
0 1 0
370370
Testing that NOT is associative
371371
select NOT NOT TRUE, NOT NOT NOT FALSE;
372-
TRUE NOT NOT NOT FALSE
372+
NOT NOT TRUE NOT NOT NOT FALSE
373373
1 1
374374
Testing that IS has precedence over NOT
375375
select (NOT NULL) IS TRUE, NOT (NULL IS TRUE), NOT NULL IS TRUE;

sql/item.cc

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2900,6 +2900,14 @@ void Item_int::print(String *str, enum_query_type query_type)
29002900
}
29012901

29022902

2903+
Item *Item_bool::neg_transformer(THD *thd)
2904+
{
2905+
value= !value;
2906+
name= 0;
2907+
return this;
2908+
}
2909+
2910+
29032911
Item_uint::Item_uint(THD *thd, const char *str_arg, uint length):
29042912
Item_int(thd, str_arg, length)
29052913
{

sql/item.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3008,6 +3008,7 @@ class Item_bool :public Item_int
30083008
Item_bool(THD *thd, const char *str_arg, longlong i):
30093009
Item_int(thd, str_arg, i, 1) {}
30103010
bool is_bool_type() { return true; }
3011+
Item *neg_transformer(THD *thd);
30113012
};
30123013

30133014

0 commit comments

Comments
 (0)