diff options
author | unknown <gshchepa/uchum@gshchepa.loc> | 2007-04-20 15:31:33 +0500 |
---|---|---|
committer | unknown <gshchepa/uchum@gshchepa.loc> | 2007-04-20 15:31:33 +0500 |
commit | a501fdd695a43905d89d7eb9157d3757d75f79bc (patch) | |
tree | bdf1e76b1cbfea7cafc8a0d548a68d660c6b51e2 /sql/item_cmpfunc.cc | |
parent | 5b0ec8709ad4946260e257916a31d213b6168d26 (diff) | |
parent | a8f639fccc19ef80d67c52e698bf6366fdcf6f94 (diff) | |
download | mariadb-git-a501fdd695a43905d89d7eb9157d3757d75f79bc.tar.gz |
Merge gshchepa.loc:/home/uchum/work/bk-trees/mysql-4.1-opt-27704
into gshchepa.loc:/home/uchum/work/bk-trees/mysql-5.0-opt-27704
mysql-test/r/subselect.result:
Auto merged
mysql-test/t/row.test:
Auto merged
mysql-test/r/row.result:
Test case updated for Bug#27704 (incorrect comparison
of rows with NULL components).
sql/item_cmpfunc.cc:
Bug#27704: incorrect comparison of rows with NULL components.
sql/item_cmpfunc.h:
Bug#27704: incorrect comparison of rows with NULL components.
Cosmetic fix.
Diffstat (limited to 'sql/item_cmpfunc.cc')
-rw-r--r-- | sql/item_cmpfunc.cc | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc index f9844f6d36e..a2a68151b7a 100644 --- a/sql/item_cmpfunc.cc +++ b/sql/item_cmpfunc.cc @@ -811,8 +811,18 @@ int Arg_comparator::compare_row() if (owner->null_value) { // NULL was compared - if (owner->abort_on_null) - return -1; // We do not need correct NULL returning + switch (owner->functype()) { + case Item_func::NE_FUNC: + break; // NE never aborts on NULL even if abort_on_null is set + case Item_func::LT_FUNC: + case Item_func::LE_FUNC: + case Item_func::GT_FUNC: + case Item_func::GE_FUNC: + return -1; // <, <=, > and >= always fail on NULL + default: // EQ_FUNC + if (owner->abort_on_null) + return -1; // We do not need correct NULL returning + } was_null= 1; owner->null_value= 0; res= 0; // continue comparison (maybe we will meet explicit difference) @@ -823,8 +833,8 @@ int Arg_comparator::compare_row() if (was_null) { /* - There was NULL(s) in comparison in some parts, but there was not - explicit difference in other parts, so we have to return NULL + There was NULL(s) in comparison in some parts, but there was no + explicit difference in other parts, so we have to return NULL. */ owner->null_value= 1; return -1; |