Commit d025029d authored by monty@hundin.mysql.fi's avatar monty@hundin.mysql.fi
Browse files

Fix for ISNULL()

parent d6fcf75a
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -46916,6 +46916,10 @@ not yet 100% confident in this code.
@appendixsubsec Changes in release 3.23.51
@itemize @bullet
@item
Removed BDB documentation.
@item
Fixed mit-pthreads to compile with glibc 2.2 (needed for @code{make dist}).
@item
Fixed the @code{FLOAT(X+1,X)} is not converted to @code{FLOAT(X+2,X)}.
(This also affected @code{DECIMAL}, @code{DOUBLE} and @code{REAL} types)
@item
@@ -46929,7 +46933,8 @@ Fixed that underflowed decimal fields is not zero filled.
If we get an overflow when inserting @code{'+11111'} for
@code{decimal(5,0) unsigned} columns, we will just drop the sign.
@item
Fixed bug with @code{ISNULL(expression_which_cannot_be_null)}.
Fixed optimization bug with @code{ISNULL(expression_which_cannot_be_null)} and
@code{ISNULL(constant_expression)}.
@item
Fixed host lookup bug in the glibc library that we used with the 3.23.50
Linux-x86 binaries.
+3 −0
Original line number Diff line number Diff line
@@ -27,6 +27,9 @@ d d
0000-00-00	NULL
d
0000-00-00
d
2001-08-01
0000-00-00
COUNT(t1.Title)
1
COUNT(t1.Title)
+1 −0
Original line number Diff line number Diff line
@@ -120,6 +120,7 @@ CREATE TABLE t2 (d DATE NOT NULL);
INSERT INTO t1 (d) VALUES ('2001-08-01'),('0000-00-00');
SELECT * FROM t1 LEFT JOIN t2 USING (d) WHERE t2.d IS NULL;
SELECT * from t1 WHERE t1.d IS NULL;
SELECT * FROM t1 WHERE 1/0 IS NULL;
DROP TABLE t1,t2;

#
+1 −1
Original line number Diff line number Diff line
@@ -1211,7 +1211,7 @@ longlong Item_func_isnull::val_int()
    This has to be here because of the test in update_used_tables().
  */
  if (!used_tables_cache)
    return 0;
    return cached_value;
  (void) args[0]->val();
  return (args[0]->null_value) ? 1 : 0;
}
+7 −0
Original line number Diff line number Diff line
@@ -429,6 +429,7 @@ class Item_func_in :public Item_int_func

class Item_func_isnull :public Item_bool_func
{
  longlong cached_value;
public:
  Item_func_isnull(Item *a) :Item_bool_func(a) {}
  longlong val_int();
@@ -449,6 +450,12 @@ class Item_func_isnull :public Item_bool_func
      args[0]->update_used_tables();
      used_tables_cache=args[0]->used_tables();
    }
    if (!used_tables_cache)
    {
      /* Remember if the value is always NULL or never NULL */
      args[0]->val();
      cached_value= args[0]->null_value ? (longlong) 1 : (longlong) 0;
    }
  }
  optimize_type select_optimize() const { return OPTIMIZE_NULL; }
};
Loading