summaryrefslogtreecommitdiff
path: root/sql/item_cmpfunc.cc
diff options
context:
space:
mode:
authorunknown <sergefp@mysql.com>2006-07-21 03:04:04 +0400
committerunknown <sergefp@mysql.com>2006-07-21 03:04:04 +0400
commit68698c04abfbcbee1b67b5daca6695ada679ac4f (patch)
tree870ce9c07717c98bedb9710afb3c7278c02b623f /sql/item_cmpfunc.cc
parent6ec7976df97d5c9ced3f2e50339c74f19cda32fd (diff)
downloadmariadb-git-68698c04abfbcbee1b67b5daca6695ada679ac4f.tar.gz
BUG#20975: Incorrect query result for NOT (subquery):
Add implementations of Item_func_{nop,not}_all::neg_transformer mysql-test/r/subselect.result: BUG#20975: testcase mysql-test/t/subselect.test: BUG#20975: testcase sql/mysql_priv.h: Make chooser_compare_func_creator visible in item.h
Diffstat (limited to 'sql/item_cmpfunc.cc')
-rw-r--r--sql/item_cmpfunc.cc22
1 files changed, 22 insertions, 0 deletions
diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc
index f14efc7187b..a32bd0a7337 100644
--- a/sql/item_cmpfunc.cc
+++ b/sql/item_cmpfunc.cc
@@ -3099,6 +3099,28 @@ Item *Item_cond_or::neg_transformer(THD *thd) /* NOT(a OR b OR ...) -> */
}
+Item *Item_func_nop_all::neg_transformer(THD *thd)
+{
+ /* "NOT (e $cmp$ ANY (SELECT ...)) -> e $rev_cmp$" ALL (SELECT ...) */
+ Item_func_not_all *new_item= new Item_func_not_all(args[0]);
+ Item_allany_subselect *allany= (Item_allany_subselect*)args[0];
+ allany->func= allany->func_creator(FALSE);
+ allany->all= !allany->all;
+ allany->upper_item= new_item;
+ return new_item;
+}
+
+Item *Item_func_not_all::neg_transformer(THD *thd)
+{
+ /* "NOT (e $cmp$ ALL (SELECT ...)) -> e $rev_cmp$" ANY (SELECT ...) */
+ Item_func_nop_all *new_item= new Item_func_nop_all(args[0]);
+ Item_allany_subselect *allany= (Item_allany_subselect*)args[0];
+ allany->all= !allany->all;
+ allany->func= allany->func_creator(TRUE);
+ allany->upper_item= new_item;
+ return new_item;
+}
+
Item *Item_func_eq::negated_item() /* a = b -> a != b */
{
return new Item_func_ne(args[0], args[1]);