summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Barkov <bar@mariadb.org>2015-03-25 13:06:04 +0400
committerAlexander Barkov <bar@mariadb.org>2015-03-25 13:06:04 +0400
commit651a142ad02dc51926f8159d9e923552f782612e (patch)
treec289c02021c8c9814081c41819656d00d1016116
parentbd2ae787ea273169dc88db62bc1e66d56cbe9a4c (diff)
downloadmariadb-git-651a142ad02dc51926f8159d9e923552f782612e.tar.gz
MDEV-7831 Bad warning for DATE_ADD(timestamp_column, INTERVAL 10 SECOND)
-rw-r--r--mysql-test/r/partition_datatype.result16
-rw-r--r--mysql-test/r/type_timestamp.result17
-rw-r--r--mysql-test/suite/vcol/r/vcol_misc.result4
-rw-r--r--mysql-test/t/type_timestamp.test17
-rw-r--r--sql/field.cc2
5 files changed, 45 insertions, 11 deletions
diff --git a/mysql-test/r/partition_datatype.result b/mysql-test/r/partition_datatype.result
index 804d9dd1c34..080b008c690 100644
--- a/mysql-test/r/partition_datatype.result
+++ b/mysql-test/r/partition_datatype.result
@@ -699,7 +699,7 @@ a tz
2038-01-19 03:14:06 Moscow
UPDATE t2 SET a = TIMESTAMPADD(SECOND, 1, a);
Warnings:
-Warning 1292 Incorrect datetime value: '0000-00-00'
+Warning 1292 Incorrect datetime value: '0000-00-00 00:00:00'
Warning 1264 Out of range value for column 'a' at row 34
Warning 1264 Out of range value for column 'a' at row 35
SELECT MIN(a), MAX(a) FROM t2;
@@ -782,9 +782,9 @@ a tz
2011-10-30 00:00:02 Moscow
UPDATE t2 SET a = TIMESTAMPADD(SECOND, -1, a);
Warnings:
-Warning 1292 Incorrect datetime value: '0000-00-00'
-Warning 1292 Incorrect datetime value: '0000-00-00'
-Warning 1292 Incorrect datetime value: '0000-00-00'
+Warning 1292 Incorrect datetime value: '0000-00-00 00:00:00'
+Warning 1292 Incorrect datetime value: '0000-00-00 00:00:00'
+Warning 1292 Incorrect datetime value: '0000-00-00 00:00:00'
SELECT MIN(a), MAX(a) FROM t2;
MIN(a) MAX(a)
1970-01-01 00:00:01 2038-01-19 03:14:06
@@ -1179,7 +1179,7 @@ a tz
2038-01-19 06:14:06 Moscow
UPDATE t2 SET a = TIMESTAMPADD(SECOND, 1, a);
Warnings:
-Warning 1292 Incorrect datetime value: '0000-00-00'
+Warning 1292 Incorrect datetime value: '0000-00-00 00:00:00'
Warning 1299 Invalid TIMESTAMP value in column 'a' at row 8
Warning 1299 Invalid TIMESTAMP value in column 'a' at row 9
Warning 1264 Out of range value for column 'a' at row 34
@@ -1264,9 +1264,9 @@ a tz
2011-10-30 03:00:02 Moscow
UPDATE t2 SET a = TIMESTAMPADD(SECOND, -1, a);
Warnings:
-Warning 1292 Incorrect datetime value: '0000-00-00'
-Warning 1292 Incorrect datetime value: '0000-00-00'
-Warning 1292 Incorrect datetime value: '0000-00-00'
+Warning 1292 Incorrect datetime value: '0000-00-00 00:00:00'
+Warning 1292 Incorrect datetime value: '0000-00-00 00:00:00'
+Warning 1292 Incorrect datetime value: '0000-00-00 00:00:00'
Warning 1299 Invalid TIMESTAMP value in column 'a' at row 18
Warning 1299 Invalid TIMESTAMP value in column 'a' at row 19
SELECT MIN(a), MAX(a) FROM t2;
diff --git a/mysql-test/r/type_timestamp.result b/mysql-test/r/type_timestamp.result
index 38838e72e96..556e5403591 100644
--- a/mysql-test/r/type_timestamp.result
+++ b/mysql-test/r/type_timestamp.result
@@ -691,3 +691,20 @@ drop function f1;
set timestamp=0;
SET time_zone=DEFAULT;
End of 10.0 tests
+#
+# Start of 10.1 tests
+#
+#
+# MDEV-7831 Bad warning for DATE_ADD(timestamp_column, INTERVAL 10 SECOND)
+#
+CREATE TABLE t1 (a TIMESTAMP);
+INSERT INTO t1 VALUES ('0000-00-00 00:00:00');
+SELECT DATE_ADD(a, INTERVAL 10 SECOND) FROM t1;
+DATE_ADD(a, INTERVAL 10 SECOND)
+NULL
+Warnings:
+Warning 1292 Incorrect datetime value: '0000-00-00 00:00:00'
+DROP TABLE t1;
+#
+# End of 10.1 tests
+#
diff --git a/mysql-test/suite/vcol/r/vcol_misc.result b/mysql-test/suite/vcol/r/vcol_misc.result
index 8631789f15f..521952f4373 100644
--- a/mysql-test/suite/vcol/r/vcol_misc.result
+++ b/mysql-test/suite/vcol/r/vcol_misc.result
@@ -188,10 +188,10 @@ tsv TIMESTAMP AS (ADDDATE(ts, INTERVAL 1 DAY)) VIRTUAL
) ENGINE=MyISAM;
INSERT INTO t1 (tsv) VALUES (DEFAULT);
Warnings:
-Warning 1292 Incorrect datetime value: '0000-00-00'
+Warning 1292 Incorrect datetime value: '0000-00-00 00:00:00'
INSERT DELAYED INTO t1 (tsv) VALUES (DEFAULT);
Warnings:
-Warning 1292 Incorrect datetime value: '0000-00-00'
+Warning 1292 Incorrect datetime value: '0000-00-00 00:00:00'
FLUSH TABLES;
SELECT COUNT(*) FROM t1;
COUNT(*)
diff --git a/mysql-test/t/type_timestamp.test b/mysql-test/t/type_timestamp.test
index 77ce8c595ca..ed5a57b5eaf 100644
--- a/mysql-test/t/type_timestamp.test
+++ b/mysql-test/t/type_timestamp.test
@@ -493,3 +493,20 @@ set timestamp=0;
SET time_zone=DEFAULT;
--echo End of 10.0 tests
+
+--echo #
+--echo # Start of 10.1 tests
+--echo #
+
+--echo #
+--echo # MDEV-7831 Bad warning for DATE_ADD(timestamp_column, INTERVAL 10 SECOND)
+--echo #
+CREATE TABLE t1 (a TIMESTAMP);
+INSERT INTO t1 VALUES ('0000-00-00 00:00:00');
+SELECT DATE_ADD(a, INTERVAL 10 SECOND) FROM t1;
+DROP TABLE t1;
+
+
+--echo #
+--echo # End of 10.1 tests
+--echo #
diff --git a/sql/field.cc b/sql/field.cc
index 0f29c5cbfea..e99f48dd078 100644
--- a/sql/field.cc
+++ b/sql/field.cc
@@ -4842,7 +4842,7 @@ bool Field_timestamp::get_date(MYSQL_TIME *ltime, ulonglong fuzzydate)
{ /* Zero time is "000000" */
if (fuzzydate & TIME_NO_ZERO_DATE)
return 1;
- bzero((char*) ltime,sizeof(*ltime));
+ set_zero_time(ltime, MYSQL_TIMESTAMP_DATETIME);
}
else
{