Commit 5e0c80c2 authored by Alexander Barkov's avatar Alexander Barkov

An extra test with NULLIF() for MDEV-13995 MAX(timestamp) returns a wrong result near DST change

parent 088de81d
......@@ -574,6 +574,22 @@ a b
SELECT * FROM t1 WHERE a IN ((SELECT MAX(b) FROM t1), (SELECT MIN(b) FROM t1));
a b
DROP TABLE t1;
SET time_zone='Europe/Moscow';
CREATE TABLE t1 (a TIMESTAMP);
CREATE TABLE t2 (a TIMESTAMP);
SET timestamp=1288479599 /*summer time in Mowcow*/;
INSERT INTO t1 VALUES (CURRENT_TIMESTAMP);
SET timestamp=1288479599+3600 /*winter time in Mowcow*/;
INSERT INTO t2 VALUES (CURRENT_TIMESTAMP);
SELECT t1.a, UNIX_TIMESTAMP(t1.a), t2.a, UNIX_TIMESTAMP(t2.a) FROM t1, t2;
a UNIX_TIMESTAMP(t1.a) a UNIX_TIMESTAMP(t2.a)
2010-10-31 02:59:59 1288479599 2010-10-31 02:59:59 1288483199
SELECT NULLIF(t1.a, t2.a) FROM t1,t2;
NULLIF(t1.a, t2.a)
2010-10-31 02:59:59
DROP TABLE t1, t2;
SET time_zone=DEFAULT;
SET timestamp=DEFAULT;
#
# MDEV-17979 Assertion `0' failed in Item::val_native upon SELECT with timestamp, NULLIF, GROUP BY
#
......
......@@ -521,6 +521,23 @@ SELECT * FROM t1 WHERE a = (SELECT MIN(b) FROM t1);
SELECT * FROM t1 WHERE a IN ((SELECT MAX(b) FROM t1), (SELECT MIN(b) FROM t1));
DROP TABLE t1;
# NULLIF
SET time_zone='Europe/Moscow';
CREATE TABLE t1 (a TIMESTAMP);
CREATE TABLE t2 (a TIMESTAMP);
SET timestamp=1288479599 /*summer time in Mowcow*/;
INSERT INTO t1 VALUES (CURRENT_TIMESTAMP);
SET timestamp=1288479599+3600 /*winter time in Mowcow*/;
INSERT INTO t2 VALUES (CURRENT_TIMESTAMP);
SELECT t1.a, UNIX_TIMESTAMP(t1.a), t2.a, UNIX_TIMESTAMP(t2.a) FROM t1, t2;
SELECT NULLIF(t1.a, t2.a) FROM t1,t2;
DROP TABLE t1, t2;
SET time_zone=DEFAULT;
SET timestamp=DEFAULT;
--echo #
--echo # MDEV-17979 Assertion `0' failed in Item::val_native upon SELECT with timestamp, NULLIF, GROUP BY
--echo #
......
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