MDEV-10236 Where expression with NOT function gives incorrect result

Item_cache::is_null() erroneously returned null_value in a
non-cached state. Now Item_cache::is_null() uses has_value(),
which caches the value if not cached yet, similar to what other value methods do
(e.g. val_int, val_real, etc).
This commit is contained in:
Alexander Barkov 2016-06-28 13:11:04 +04:00
commit 56a3496067
3 changed files with 29 additions and 1 deletions

View file

@ -1007,6 +1007,17 @@ SELECT * FROM t1 WHERE NULLIF(NULLIF(NULLIF(NULLIF(NULLIF(NULLIF(NULLIF(NULLIF(N
DROP TABLE t1;
--echo #
--echo # MDEV-10236 Where expression with NOT function gives incorrect result
--echo #
CREATE TABLE t1 (c1 INT);
INSERT INTO t1 VALUES (1),(2),(3);
EXPLAIN EXTENDED
SELECT * FROM t1 WHERE ((c1 IS NOT NULL) >= (NOT TRUE)) IS NOT NULL;
SELECT * FROM t1 WHERE ((c1 IS NOT NULL) >= (NOT TRUE)) IS NOT NULL;
DROP TABLE t1;
--echo #
--echo # End of 10.1 tests
--echo #