Commit ff09512e authored by Alexander Barkov's avatar Alexander Barkov

MDEV-16489 when lead() returns null on a datetime field, the result is treated...

MDEV-16489 when lead() returns null on a datetime field, the result is treated as the literal string '[NULL]'
parent 9c53cbdd
......@@ -3317,3 +3317,20 @@ DROP TABLE t1,t2;
#
# Start of 10.3 tests
#
#
# MDEV-16489 when lead() returns null on a datetime field, the result is treated as the literal string '[NULL]'
#
CREATE TABLE t1 (d datetime);
INSERT INTO t1 VALUES ('2018-01-01 00:00:00'),('2018-02-01 00:00:00');
SELECT *, LEAD(d) OVER (ORDER BY d) AS x FROM t1;
d x
2018-01-01 00:00:00 2018-02-01 00:00:00
2018-02-01 00:00:00 NULL
DROP TABLE t1;
CREATE TABLE t1 (d time);
INSERT INTO t1 VALUES ('00:00:01'),('00:00:02');
SELECT *, LEAD(d) OVER (ORDER BY d) AS x FROM t1;
d x
00:00:01 00:00:02
00:00:02 NULL
DROP TABLE t1;
......@@ -2086,3 +2086,17 @@ DROP TABLE t1,t2;
--echo #
--echo # Start of 10.3 tests
--echo #
--echo #
--echo # MDEV-16489 when lead() returns null on a datetime field, the result is treated as the literal string '[NULL]'
--echo #
CREATE TABLE t1 (d datetime);
INSERT INTO t1 VALUES ('2018-01-01 00:00:00'),('2018-02-01 00:00:00');
SELECT *, LEAD(d) OVER (ORDER BY d) AS x FROM t1;
DROP TABLE t1;
CREATE TABLE t1 (d time);
INSERT INTO t1 VALUES ('00:00:01'),('00:00:02');
SELECT *, LEAD(d) OVER (ORDER BY d) AS x FROM t1;
DROP TABLE t1;
......@@ -444,7 +444,7 @@ bool Item_sum_hybrid_simple::get_date(MYSQL_TIME *ltime, ulonglong fuzzydate)
{
DBUG_ASSERT(fixed == 1);
if (null_value)
return 0;
return true;
bool retval= value->get_date(ltime, fuzzydate);
if ((null_value= value->null_value))
DBUG_ASSERT(retval == true);
......
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