Skip to content

Commit

Permalink
Tests for MDEV-11895 NO_ZERO_DATE affects timestamp values without an…
Browse files Browse the repository at this point in the history
…y warnings

This problem was earlier fixed, possibly by f8a800b
and is not repeatable in 10.1-10.4 any more. Adding tests only.
  • Loading branch information
abarkov committed Apr 29, 2019
1 parent e8778f1 commit 021c721
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 0 deletions.
33 changes: 33 additions & 0 deletions mysql-test/r/timezone2.result
Original file line number Diff line number Diff line change
Expand Up @@ -332,3 +332,36 @@ NULL
#
# End of 5.3 tests
#
#
# Start of 10.1 tests
#
#
# MDEV-11895 NO_ZERO_DATE affects timestamp values without any warnings
#
SET sql_mode = '';
CREATE TABLE t1 (a TIMESTAMP NULL) ENGINE = MyISAM;
CREATE TABLE t2 (a TIMESTAMP NULL) ENGINE = MyISAM;
CREATE TABLE t3 (a TIMESTAMP NULL) ENGINE = MyISAM;
SET @@session.time_zone = 'UTC';
INSERT INTO t1 VALUES ('2011-10-29 23:00:00');
INSERT INTO t1 VALUES ('2011-10-29 23:00:01');
INSERT INTO t1 VALUES ('2011-10-29 23:59:59');
SET @@session.time_zone = 'Europe/Moscow';
SET sql_mode='NO_ZERO_DATE';
INSERT INTO t2 SELECT * FROM t1;
SET sql_mode='';
INSERT INTO t3 SELECT * FROM t1;
SELECT UNIX_TIMESTAMP(a), a FROM t2;
UNIX_TIMESTAMP(a) a
1319929200 2011-10-30 02:00:00
1319929201 2011-10-30 02:00:01
1319932799 2011-10-30 02:59:59
SELECT UNIX_TIMESTAMP(a), a FROM t3;
UNIX_TIMESTAMP(a) a
1319929200 2011-10-30 02:00:00
1319929201 2011-10-30 02:00:01
1319932799 2011-10-30 02:59:59
DROP TABLE t1, t2, t3;
#
# End of 10.1 tests
#
31 changes: 31 additions & 0 deletions mysql-test/t/timezone2.test
Original file line number Diff line number Diff line change
Expand Up @@ -308,3 +308,34 @@ SELECT CONVERT_TZ('2001-10-08 00:00:00', MAKE_SET(0,'+01:00'), '+00:00' );
--echo #
--echo # End of 5.3 tests
--echo #

--echo #
--echo # Start of 10.1 tests
--echo #

--echo #
--echo # MDEV-11895 NO_ZERO_DATE affects timestamp values without any warnings
--echo #

SET sql_mode = '';
CREATE TABLE t1 (a TIMESTAMP NULL) ENGINE = MyISAM;
CREATE TABLE t2 (a TIMESTAMP NULL) ENGINE = MyISAM;
CREATE TABLE t3 (a TIMESTAMP NULL) ENGINE = MyISAM;

SET @@session.time_zone = 'UTC';
INSERT INTO t1 VALUES ('2011-10-29 23:00:00');
INSERT INTO t1 VALUES ('2011-10-29 23:00:01');
INSERT INTO t1 VALUES ('2011-10-29 23:59:59');

SET @@session.time_zone = 'Europe/Moscow';
SET sql_mode='NO_ZERO_DATE';
INSERT INTO t2 SELECT * FROM t1;
SET sql_mode='';
INSERT INTO t3 SELECT * FROM t1;
SELECT UNIX_TIMESTAMP(a), a FROM t2;
SELECT UNIX_TIMESTAMP(a), a FROM t3;
DROP TABLE t1, t2, t3;

--echo #
--echo # End of 10.1 tests
--echo #

0 comments on commit 021c721

Please sign in to comment.