Commit 7a105aff authored by unknown's avatar unknown
Browse files

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


mysql-test/r/join_outer.result:
  test for some obscure usage of IS NOT NULL
mysql-test/t/join_outer.test:
  test for some obscure usage of IS NOT NULL
parent ec372b09
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -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);
+1 −0
Original line number Diff line number Diff line
@@ -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;

#
+5 −3
Original line number Diff line number Diff line
@@ -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; }
};