diff options
-rw-r--r-- | mysql-test/r/join_outer.result | 3 | ||||
-rw-r--r-- | mysql-test/t/join_outer.test | 1 | ||||
-rw-r--r-- | sql/item_cmpfunc.h | 8 |
3 files changed, 9 insertions, 3 deletions
diff --git a/mysql-test/r/join_outer.result b/mysql-test/r/join_outer.result index 01447d5e464..c278e50afdc 100644 --- a/mysql-test/r/join_outer.result +++ b/mysql-test/r/join_outer.result @@ -650,6 +650,9 @@ select * from t1 natural left join t2 natural left join t3; i i i 1 NULL NULL 2 2 2 +select * from t1 natural left join t2 where (t2.i is not null)=0; +i i +1 NULL drop table t1,t2,t3; create table t1 (f1 integer,f2 integer,f3 integer); create table t2 (f2 integer,f4 integer); diff --git a/mysql-test/t/join_outer.test b/mysql-test/t/join_outer.test index 7d85ab09b08..31ddcfd7cf4 100644 --- a/mysql-test/t/join_outer.test +++ b/mysql-test/t/join_outer.test @@ -430,6 +430,7 @@ insert into t1 values(1),(2); insert into t2 values(2),(3); insert into t3 values(2),(4); select * from t1 natural left join t2 natural left join t3; +select * from t1 natural left join t2 where (t2.i is not null)=0; drop table t1,t2,t3; # diff --git a/sql/item_cmpfunc.h b/sql/item_cmpfunc.h index 38717672ba8..522f93b5e77 100644 --- a/sql/item_cmpfunc.h +++ b/sql/item_cmpfunc.h @@ -905,8 +905,9 @@ public: class Item_func_isnotnull :public Item_bool_func { + bool abort_on_null; public: - Item_func_isnotnull(Item *a) :Item_bool_func(a) {} + Item_func_isnotnull(Item *a) :Item_bool_func(a), abort_on_null(0) {} longlong val_int(); enum Functype functype() const { return ISNOTNULL_FUNC; } void fix_length_and_dec() @@ -915,10 +916,11 @@ public: } const char *func_name() const { return "isnotnull"; } optimize_type select_optimize() const { return OPTIMIZE_NULL; } - table_map not_null_tables() const { return used_tables(); } + table_map not_null_tables() const { return abort_on_null ? used_tables() : 0; } Item *neg_transformer(THD *thd); void print(String *str); CHARSET_INFO *compare_collation() { return args[0]->collation.collation; } + void top_level_item() { abort_on_null=1; } }; @@ -1004,7 +1006,7 @@ public: /* Item_cond() is only used to create top level items */ Item_cond(): Item_bool_func(), abort_on_null(1) { const_item_cache=0; } - Item_cond(Item *i1,Item *i2) + Item_cond(Item *i1,Item *i2) :Item_bool_func(), abort_on_null(0) { list.push_back(i1); |