diff options
author | Martin Hansson <martin.hansson@oracle.com> | 2011-04-18 10:44:41 +0200 |
---|---|---|
committer | Martin Hansson <martin.hansson@oracle.com> | 2011-04-18 10:44:41 +0200 |
commit | 8dabe8aa92bb825d2bd2a78d2cb5ca30782576be (patch) | |
tree | b0b7ee3b50d5b6edf2990ea8b056b8ed26bfeb98 /mysql-test/t | |
parent | 5d535879490ae25450dcb4c94ef67d8e744e7d4a (diff) | |
download | mariadb-git-8dabe8aa92bb825d2bd2a78d2cb5ca30782576be.tar.gz |
Bug 11758558 - 50774: WRONG RESULTSET WHEN TIMESTAMP VALUES ARE APPENDED WITH
.0
The bug was fixed by the patch for bug number BUG 11763109 - 55779: SELECT
DOES NOT WORK PROPERLY IN MYSQL SERVER VERSION "5.1.42 SUSE MYSQL (Exact same
fix as was proposed for this bug.) Since the motivation for the two bug
reports was completely different, however, it still makes sense to push the
test case.
This patch contains only the test case.
Diffstat (limited to 'mysql-test/t')
-rw-r--r-- | mysql-test/t/type_timestamp.test | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/mysql-test/t/type_timestamp.test b/mysql-test/t/type_timestamp.test index 602f6f089c2..53b45fc6732 100644 --- a/mysql-test/t/type_timestamp.test +++ b/mysql-test/t/type_timestamp.test @@ -373,4 +373,51 @@ SELECT a FROM t1 WHERE a >= '20000101000000'; DROP TABLE t1; +--echo # +--echo # Bug#50774: failed to get the correct resultset when timestamp values +--echo # are appended with .0 +--echo # +CREATE TABLE t1 ( a TIMESTAMP, KEY ( a ) ); + +INSERT INTO t1 VALUES( '2010-02-01 09:31:01' ); +INSERT INTO t1 VALUES( '2010-02-01 09:31:02' ); +INSERT INTO t1 VALUES( '2010-02-01 09:31:03' ); +INSERT INTO t1 VALUES( '2010-02-01 09:31:04' ); + +SELECT * FROM t1 WHERE a >= '2010-02-01 09:31:02.0'; +SELECT * FROM t1 WHERE '2010-02-01 09:31:02.0' <= a; +SELECT * FROM t1 WHERE a <= '2010-02-01 09:31:02.0'; +SELECT * FROM t1 WHERE '2010-02-01 09:31:02.0' >= a; + +--replace_column 1 x 2 x 3 x 5 x 6 x 7 x 8 x 9 x 10 x +EXPLAIN +SELECT * FROM t1 WHERE a >= '2010-02-01 09:31:02.0'; +SELECT * FROM t1 WHERE a >= '2010-02-01 09:31:02.0'; + +CREATE TABLE t2 ( a TIMESTAMP, KEY ( a DESC ) ); + +INSERT INTO t2 VALUES( '2010-02-01 09:31:01' ); +INSERT INTO t2 VALUES( '2010-02-01 09:31:02' ); +INSERT INTO t2 VALUES( '2010-02-01 09:31:03' ); +INSERT INTO t2 VALUES( '2010-02-01 09:31:04' ); +INSERT INTO t2 VALUES( '2010-02-01 09:31:05' ); +INSERT INTO t2 VALUES( '2010-02-01 09:31:06' ); +INSERT INTO t2 VALUES( '2010-02-01 09:31:07' ); +INSERT INTO t2 VALUES( '2010-02-01 09:31:08' ); +INSERT INTO t2 VALUES( '2010-02-01 09:31:09' ); +INSERT INTO t2 VALUES( '2010-02-01 09:31:10' ); +INSERT INTO t2 VALUES( '2010-02-01 09:31:11' ); + +--echo # The bug would cause the range optimizer's comparison to use an open +--echo # interval here. This reveals itself only in the number of reads +--echo # performed. +FLUSH STATUS; +--replace_column 1 x 2 x 3 x 5 x 6 x 7 x 8 x 9 x 10 x +EXPLAIN +SELECT * FROM t2 WHERE a < '2010-02-01 09:31:02.0'; +SELECT * FROM t2 WHERE a < '2010-02-01 09:31:02.0'; +SHOW STATUS LIKE 'Handler_read_next'; + +DROP TABLE t1, t2; + --echo End of 5.1 tests |