Commit 72c5a8d3 authored by Alexander Barkov's avatar Alexander Barkov

MDEV-20417 Assertion `(m_ptr == __null) == item->null_value' failed in VDec::VDec(Item*)

parent 4a490d1a
......@@ -1267,5 +1267,35 @@ f
DROP TABLE t1;
SET sql_mode=DEFAULT;
#
# MDEV-20417 Assertion `(m_ptr == __null) == item->null_value' failed in VDec::VDec(Item*)
#
CREATE TABLE t1 (a TIMESTAMP(4), b TIMESTAMP DEFAULT 0) ENGINE=MyISAM;
INSERT IGNORE INTO t1 VALUES ('2001-01-01','2002-01-01'),('2003-01-01','2004-01-01');
SELECT * FROM t1 WHERE DEFAULT(b) - a;
a b
Warnings:
Warning 1916 Got overflow when converting '-20010101000000' to UNSIGNED INT. Value truncated
Warning 1916 Got overflow when converting '-20030101000000' to UNSIGNED INT. Value truncated
SELECT LEFT('', DEFAULT(b)-a) FROM t1;
LEFT('', DEFAULT(b)-a)
Warnings:
Warning 1916 Got overflow when converting '-20010101000000' to UNSIGNED INT. Value truncated
Warning 1916 Got overflow when converting '-20030101000000' to UNSIGNED INT. Value truncated
DROP TABLE t1;
CREATE TABLE t1 (a TIMESTAMP(4), b TIMESTAMP DEFAULT 0) ENGINE=MyISAM;
INSERT IGNORE INTO t1 (a) VALUES ('2001-01-01'),('2003-01-01');
SELECT * FROM t1 WHERE (SELECT MIN(b) FROM t1) - a;
a b
Warnings:
Warning 1916 Got overflow when converting '-20010101000000' to UNSIGNED INT. Value truncated
Warning 1916 Got overflow when converting '-20030101000000' to UNSIGNED INT. Value truncated
SELECT (SELECT MIN(b) FROM t1) - a FROM t1;
(SELECT MIN(b) FROM t1) - a
-20010101000000.0000
-20030101000000.0000
DROP TABLE t1;
#
# End of 10.4 tests
#
......@@ -837,6 +837,24 @@ SELECT GREATEST(a,b) AS f FROM t1 ORDER BY 1 DESC;
DROP TABLE t1;
SET sql_mode=DEFAULT;
--echo #
--echo # MDEV-20417 Assertion `(m_ptr == __null) == item->null_value' failed in VDec::VDec(Item*)
--echo #
CREATE TABLE t1 (a TIMESTAMP(4), b TIMESTAMP DEFAULT 0) ENGINE=MyISAM;
INSERT IGNORE INTO t1 VALUES ('2001-01-01','2002-01-01'),('2003-01-01','2004-01-01');
SELECT * FROM t1 WHERE DEFAULT(b) - a;
SELECT LEFT('', DEFAULT(b)-a) FROM t1;
DROP TABLE t1;
CREATE TABLE t1 (a TIMESTAMP(4), b TIMESTAMP DEFAULT 0) ENGINE=MyISAM;
INSERT IGNORE INTO t1 (a) VALUES ('2001-01-01'),('2003-01-01');
SELECT * FROM t1 WHERE (SELECT MIN(b) FROM t1) - a;
SELECT (SELECT MIN(b) FROM t1) - a FROM t1;
DROP TABLE t1;
--echo #
--echo # End of 10.4 tests
--echo #
......@@ -2439,7 +2439,7 @@ class Timestamp_or_zero_datetime: protected Timestamp
Datetime to_datetime(THD *thd) const
{
if (is_zero_datetime())
return Datetime();
return Datetime::zero();
return Timestamp::to_datetime(thd);
}
bool is_zero_datetime() const { return m_is_zero_datetime; }
......@@ -2487,7 +2487,7 @@ class Timestamp_or_zero_datetime_native:
Datetime to_datetime(THD *thd) const
{
return is_zero_datetime() ?
Datetime() :
Datetime::zero() :
Datetime(thd, Timestamp(*this).tv());
}
bool is_zero_datetime() const
......
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