summaryrefslogtreecommitdiff
path: root/sql/item_cmpfunc.cc
diff options
context:
space:
mode:
authorOle John Aske <ole.john.aske@oracle.com>2011-01-13 09:33:30 +0100
committerOle John Aske <ole.john.aske@oracle.com>2011-01-13 09:33:30 +0100
commit3e1ce666c48eca350c2625e5074e5049ae01eccb (patch)
tree3bd1368071c587a23d2e952392ba6540dd8e1d0c /sql/item_cmpfunc.cc
parentcecc99db2046853d536071a89fc8798307d1f35f (diff)
downloadmariadb-git-3e1ce666c48eca350c2625e5074e5049ae01eccb.tar.gz
Fix for Bug#57034 incorrect OUTER JOIN result when joined on unique key
Item_equal::val_int() checked for NULL-values by checking Item::null_value *before* the respective ::store_value() and ::cmp(Item*) metods where called. As Item::null_value is set by these metods, the value of 'null_value' is not valid until *after* ::store_value() or ::cmp() has been called for the Item object. Fix is to swap order of ::store_value()/::cmp() and checking of Item::null_value. This pattern is widely used other places inside item_cmpfunc.cc .
Diffstat (limited to 'sql/item_cmpfunc.cc')
-rw-r--r--sql/item_cmpfunc.cc4
1 files changed, 2 insertions, 2 deletions
diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc
index fe8ff3a74d0..ac13ca8a8c5 100644
--- a/sql/item_cmpfunc.cc
+++ b/sql/item_cmpfunc.cc
@@ -5643,15 +5643,15 @@ longlong Item_equal::val_int()
return 0;
List_iterator_fast<Item_field> it(fields);
Item *item= const_item ? const_item : it++;
+ eval_item->store_value(item);
if ((null_value= item->null_value))
return 0;
- eval_item->store_value(item);
while ((item_field= it++))
{
/* Skip fields of non-const tables. They haven't been read yet */
if (item_field->field->table->const_table)
{
- if ((null_value= item_field->null_value) || eval_item->cmp(item_field))
+ if (eval_item->cmp(item_field) || (null_value= item_field->null_value))
return 0;
}
}