summaryrefslogtreecommitdiff
path: root/sql/sql_parse.cc
diff options
context:
space:
mode:
authorunknown <sanja@askmonty.org>2011-07-21 13:15:09 +0300
committerunknown <sanja@askmonty.org>2011-07-21 13:15:09 +0300
commitf675536aa48fd314ade0ee1ed56a44d4558642b4 (patch)
tree3fd031f88ec93de785a134844a5d1233713fd8e0 /sql/sql_parse.cc
parent30370ee2f040d76fd4122fdb34de807a5b82f2c8 (diff)
parentee06e4d65e42d303389605f3d30cbf0892be96af (diff)
downloadmariadb-git-f675536aa48fd314ade0ee1ed56a44d4558642b4.tar.gz
Merge 5.1->5.2
Diffstat (limited to 'sql/sql_parse.cc')
-rw-r--r--sql/sql_parse.cc23
1 files changed, 23 insertions, 0 deletions
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index e4169b1da62..c930eb0824a 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -6856,6 +6856,28 @@ push_new_name_resolution_context(THD *thd,
/**
+ Fix condition which contains only field (f turns to f <> 0 )
+
+ @param cond The condition to fix
+
+ @return fixed condition
+*/
+
+Item *normalize_cond(Item *cond)
+{
+ if (cond)
+ {
+ Item::Type type= cond->type();
+ if (type == Item::FIELD_ITEM || type == Item::REF_ITEM)
+ {
+ cond= new Item_func_ne(cond, new Item_int(0));
+ }
+ }
+ return cond;
+}
+
+
+/**
Add an ON condition to the second operand of a JOIN ... ON.
Add an ON condition to the right operand of a JOIN ... ON clause.
@@ -6873,6 +6895,7 @@ void add_join_on(TABLE_LIST *b, Item *expr)
{
if (expr)
{
+ expr= normalize_cond(expr);
if (!b->on_expr)
b->on_expr= expr;
else