Commit 9248f0d7 authored by serg@serg.mylan's avatar serg@serg.mylan

Item_func_isnotnull::not_null_tables - return 0 if not top-level item

parent 8986ffeb
......@@ -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);
......
......@@ -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;
#
......
......@@ -905,8 +905,9 @@ class Item_is_not_null_test :public Item_func_isnull
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 @@ class Item_func_isnotnull :public Item_bool_func
}
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 @@ class Item_cond :public Item_bool_func
/* 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);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment