mirror of
https://github.com/MariaDB/server.git
synced 2026-04-27 18:55:31 +02:00
Fix of LP BUG#780386.
ALL subquery should return TRUE if subquery rowa set is empty independently of left part. The problem was that Item_func_(eq,ne,gt,ge,lt,le) do not call execution of second argument if first is NULL no in this case subquery will not be executed and when Item_func_not_all calls any_value() of the subquery or aggregation function which report that there was rows. So for NULL < ALL (SELECT...) result was FALSE instead of TRUE. Fix is just swapping of arguments of Item_func_(eq,ne,gt,ge,lt,le) (with changing the operation if it is needed) so that result will be the same (for examole a < b is equal to b > a). This fix exploit the fact that first argument will be executed in any case. mysql-test/r/subselect.result: The test suite added. mysql-test/r/subselect_no_mat.result: The test suite added. mysql-test/r/subselect_no_opts.result: The test suite added. mysql-test/r/subselect_no_semijoin.result: The test suite added. mysql-test/r/subselect_scache.result: The test suite added. mysql-test/t/subselect.test: The test suite added. sql/item_cmpfunc.cc: Swap arguments creation methods added. sql/item_cmpfunc.h: Swap arguments creation methods added. sql/item_subselect.cc: Swap arguments of the comparison.
This commit is contained in:
parent
36be492dc0
commit
2b6a23447b
9 changed files with 214 additions and 62 deletions
|
|
@ -267,7 +267,14 @@ class Comp_creator
|
|||
public:
|
||||
Comp_creator() {} /* Remove gcc warning */
|
||||
virtual ~Comp_creator() {} /* Remove gcc warning */
|
||||
/**
|
||||
Create operation with given arguments.
|
||||
*/
|
||||
virtual Item_bool_func2* create(Item *a, Item *b) const = 0;
|
||||
/**
|
||||
Create operation with given arguments in swap order.
|
||||
*/
|
||||
virtual Item_bool_func2* create_swap(Item *a, Item *b) const = 0;
|
||||
virtual const char* symbol(bool invert) const = 0;
|
||||
virtual bool eqne_op() const = 0;
|
||||
virtual bool l_op() const = 0;
|
||||
|
|
@ -279,6 +286,7 @@ public:
|
|||
Eq_creator() {} /* Remove gcc warning */
|
||||
virtual ~Eq_creator() {} /* Remove gcc warning */
|
||||
virtual Item_bool_func2* create(Item *a, Item *b) const;
|
||||
virtual Item_bool_func2* create_swap(Item *a, Item *b) const;
|
||||
virtual const char* symbol(bool invert) const { return invert? "<>" : "="; }
|
||||
virtual bool eqne_op() const { return 1; }
|
||||
virtual bool l_op() const { return 0; }
|
||||
|
|
@ -290,6 +298,7 @@ public:
|
|||
Ne_creator() {} /* Remove gcc warning */
|
||||
virtual ~Ne_creator() {} /* Remove gcc warning */
|
||||
virtual Item_bool_func2* create(Item *a, Item *b) const;
|
||||
virtual Item_bool_func2* create_swap(Item *a, Item *b) const;
|
||||
virtual const char* symbol(bool invert) const { return invert? "=" : "<>"; }
|
||||
virtual bool eqne_op() const { return 1; }
|
||||
virtual bool l_op() const { return 0; }
|
||||
|
|
@ -301,6 +310,7 @@ public:
|
|||
Gt_creator() {} /* Remove gcc warning */
|
||||
virtual ~Gt_creator() {} /* Remove gcc warning */
|
||||
virtual Item_bool_func2* create(Item *a, Item *b) const;
|
||||
virtual Item_bool_func2* create_swap(Item *a, Item *b) const;
|
||||
virtual const char* symbol(bool invert) const { return invert? "<=" : ">"; }
|
||||
virtual bool eqne_op() const { return 0; }
|
||||
virtual bool l_op() const { return 0; }
|
||||
|
|
@ -312,6 +322,7 @@ public:
|
|||
Lt_creator() {} /* Remove gcc warning */
|
||||
virtual ~Lt_creator() {} /* Remove gcc warning */
|
||||
virtual Item_bool_func2* create(Item *a, Item *b) const;
|
||||
virtual Item_bool_func2* create_swap(Item *a, Item *b) const;
|
||||
virtual const char* symbol(bool invert) const { return invert? ">=" : "<"; }
|
||||
virtual bool eqne_op() const { return 0; }
|
||||
virtual bool l_op() const { return 1; }
|
||||
|
|
@ -323,6 +334,7 @@ public:
|
|||
Ge_creator() {} /* Remove gcc warning */
|
||||
virtual ~Ge_creator() {} /* Remove gcc warning */
|
||||
virtual Item_bool_func2* create(Item *a, Item *b) const;
|
||||
virtual Item_bool_func2* create_swap(Item *a, Item *b) const;
|
||||
virtual const char* symbol(bool invert) const { return invert? "<" : ">="; }
|
||||
virtual bool eqne_op() const { return 0; }
|
||||
virtual bool l_op() const { return 0; }
|
||||
|
|
@ -334,6 +346,7 @@ public:
|
|||
Le_creator() {} /* Remove gcc warning */
|
||||
virtual ~Le_creator() {} /* Remove gcc warning */
|
||||
virtual Item_bool_func2* create(Item *a, Item *b) const;
|
||||
virtual Item_bool_func2* create_swap(Item *a, Item *b) const;
|
||||
virtual const char* symbol(bool invert) const { return invert? ">" : "<="; }
|
||||
virtual bool eqne_op() const { return 0; }
|
||||
virtual bool l_op() const { return 1; }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue