summaryrefslogtreecommitdiff
path: root/sql/sql_select.cc
diff options
context:
space:
mode:
authorunknown <Sinisa@sinisa.nasamreza.org>2003-02-06 18:50:12 +0200
committerunknown <Sinisa@sinisa.nasamreza.org>2003-02-06 18:50:12 +0200
commit82281dff1a6008f0d89e5d60e240e2c8fbf037f9 (patch)
tree5f935f2cc34f7a8aa3f981b77db8f6aefb71dce9 /sql/sql_select.cc
parent3a180c331aa30b393d8cbeff51793ed61592bd75 (diff)
downloadmariadb-git-82281dff1a6008f0d89e5d60e240e2c8fbf037f9.tar.gz
A fix for new conditions being defined and upper condition not updated
mysql-test/r/type_datetime.result: result for datetime fix mysql-test/t/type_datetime.test: test for datetime fix sql/sql_select.cc: Fix for a bug caused implicitely by MySQL having to comply with ODBC standard on datetime comparisons. This failed to update used_tables() for OR condition, which is why query returned all rows on query as in .test above, while none of types contains NULL nor 0 datetime (last one from ODBC)
Diffstat (limited to 'sql/sql_select.cc')
-rw-r--r--sql/sql_select.cc5
1 files changed, 5 insertions, 0 deletions
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index 3596fdc0c05..8444a451965 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -3009,6 +3009,7 @@ remove_eq_conds(COND *cond,Item::cond_result *cond_value)
== Item_func::COND_AND_FUNC;
List_iterator<Item> li(*((Item_cond*) cond)->argument_list());
Item::cond_result tmp_cond_value;
+ bool should_fix_fields=0;
*cond_value=Item::COND_UNDEF;
Item *item;
@@ -3028,6 +3029,7 @@ remove_eq_conds(COND *cond,Item::cond_result *cond_value)
delete item; // This may be shared
#endif
VOID(li.replace(new_item));
+ should_fix_fields=1;
}
if (*cond_value == Item::COND_UNDEF)
*cond_value=tmp_cond_value;
@@ -3054,6 +3056,9 @@ remove_eq_conds(COND *cond,Item::cond_result *cond_value)
break; /* purecov: deadcode */
}
}
+ if (should_fix_fields)
+ cond->fix_fields(current_thd,0);
+
if (!((Item_cond*) cond)->argument_list()->elements ||
*cond_value != Item::COND_OK)
return (COND*) 0;