summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
authorAlexander Barkov <bar@mariadb.com>2018-12-12 10:39:06 +0400
committerAlexander Barkov <bar@mariadb.com>2018-12-12 10:39:06 +0400
commitc353b2a8fc10e16107ee6c7e26877f4243d4eaef (patch)
tree6bb3d15613d83be28e8720f25ba4072bdbe0582f /mysql-test
parent4abb8216a054e14afbeb81e8529e02bab6fa14ac (diff)
downloadmariadb-git-c353b2a8fc10e16107ee6c7e26877f4243d4eaef.tar.gz
--echo #
--echo # MDEV-17979 Assertion `0' failed in Item::val_native upon SELECT with timestamp, NULLIF, GROUP BY --echo #
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/main/timezone2.result13
-rw-r--r--mysql-test/main/timezone2.test12
-rw-r--r--mysql-test/main/type_timestamp.result11
-rw-r--r--mysql-test/main/type_timestamp.test8
4 files changed, 44 insertions, 0 deletions
diff --git a/mysql-test/main/timezone2.result b/mysql-test/main/timezone2.result
index a58a0ee632f..dd137045d1a 100644
--- a/mysql-test/main/timezone2.result
+++ b/mysql-test/main/timezone2.result
@@ -542,5 +542,18 @@ SELECT * FROM t1 WHERE a IN ((SELECT MAX(b) FROM t1), (SELECT MIN(b) FROM t1));
a b
DROP TABLE t1;
#
+# MDEV-17979 Assertion `0' failed in Item::val_native upon SELECT with timestamp, NULLIF, GROUP BY
+#
+SET time_zone='+00:00';
+CREATE TABLE t1 (a INT, ts TIMESTAMP) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (1, FROM_UNIXTIME(1288481126) /*winter time in Moscow*/);
+SET time_zone='Europe/Moscow';
+CREATE TABLE t2 AS SELECT ts, COALESCE(ts) AS cts FROM t1 GROUP BY cts;
+SELECT ts, cts, UNIX_TIMESTAMP(ts) AS uts, UNIX_TIMESTAMP(cts) AS ucts FROM t2;
+ts cts uts ucts
+2010-10-31 02:25:26 2010-10-31 02:25:26 1288481126 1288481126
+DROP TABLE t1,t2;
+SET time_zone=DEFAULT;
+#
# End of 10.4 tests
#
diff --git a/mysql-test/main/timezone2.test b/mysql-test/main/timezone2.test
index e0c6eb08108..db515653651 100644
--- a/mysql-test/main/timezone2.test
+++ b/mysql-test/main/timezone2.test
@@ -490,6 +490,18 @@ 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;
+--echo #
+--echo # MDEV-17979 Assertion `0' failed in Item::val_native upon SELECT with timestamp, NULLIF, GROUP BY
+--echo #
+
+SET time_zone='+00:00';
+CREATE TABLE t1 (a INT, ts TIMESTAMP) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (1, FROM_UNIXTIME(1288481126) /*winter time in Moscow*/);
+SET time_zone='Europe/Moscow';
+CREATE TABLE t2 AS SELECT ts, COALESCE(ts) AS cts FROM t1 GROUP BY cts;
+SELECT ts, cts, UNIX_TIMESTAMP(ts) AS uts, UNIX_TIMESTAMP(cts) AS ucts FROM t2;
+DROP TABLE t1,t2;
+SET time_zone=DEFAULT;
--echo #
--echo # End of 10.4 tests
diff --git a/mysql-test/main/type_timestamp.result b/mysql-test/main/type_timestamp.result
index 20f258ea261..439532131cc 100644
--- a/mysql-test/main/type_timestamp.result
+++ b/mysql-test/main/type_timestamp.result
@@ -1118,5 +1118,16 @@ ERROR 22007: Incorrect datetime value: '0000-00-00 00:00:00' for column 'a' at r
DROP TABLE t1;
SET sql_mode=DEFAULT;
#
+# MDEV-17979 Assertion `0' failed in Item::val_native upon SELECT with timestamp, NULLIF, GROUP BY
+#
+CREATE TABLE t1 (a INT, b TIMESTAMP) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (1,'2018-06-19 00:00:00');
+SELECT NULLIF(b, 'N/A') AS f, MAX(a) FROM t1 GROUP BY f;
+f MAX(a)
+2018-06-19 00:00:00 1
+Warnings:
+Warning 1292 Truncated incorrect datetime value: 'N/A'
+DROP TABLE t1;
+#
# End of 10.4 tests
#
diff --git a/mysql-test/main/type_timestamp.test b/mysql-test/main/type_timestamp.test
index 28fa562cb53..5458d301a82 100644
--- a/mysql-test/main/type_timestamp.test
+++ b/mysql-test/main/type_timestamp.test
@@ -709,6 +709,14 @@ UPDATE t1 SET a=COALESCE(b);
DROP TABLE t1;
SET sql_mode=DEFAULT;
+--echo #
+--echo # MDEV-17979 Assertion `0' failed in Item::val_native upon SELECT with timestamp, NULLIF, GROUP BY
+--echo #
+
+CREATE TABLE t1 (a INT, b TIMESTAMP) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (1,'2018-06-19 00:00:00');
+SELECT NULLIF(b, 'N/A') AS f, MAX(a) FROM t1 GROUP BY f;
+DROP TABLE t1;
--echo #
--echo # End of 10.4 tests