diff options
author | unknown <igor@rurik.mysql.com> | 2006-04-11 10:03:37 -0700 |
---|---|---|
committer | unknown <igor@rurik.mysql.com> | 2006-04-11 10:03:37 -0700 |
commit | 981bbaef876443c20ecadaf2f0e7fedf653c9d08 (patch) | |
tree | bb59b6ab1799d89d0d0b930d679689362f75e907 /mysql-test/r/func_time.result | |
parent | 6978949b49a6c9b2746ac8aab1a1362c5db8d576 (diff) | |
download | mariadb-git-981bbaef876443c20ecadaf2f0e7fedf653c9d08.tar.gz |
Fixed bug #18618.
If the second or the third argument of a BETWEEN predicate was
a constant expression, like '2005.09.01' - INTERVAL 6 MONTH,
while the other two arguments were fields then the predicate
was evaluated incorrectly and the query returned a wrong
result set.
The bug was introduced in 5.0.17 when in the fix for 12612.
mysql-test/r/func_time.result:
Added a test case for bug #18618.
mysql-test/t/func_time.test:
Added a test case for bug #18618.
Diffstat (limited to 'mysql-test/r/func_time.result')
-rw-r--r-- | mysql-test/r/func_time.result | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/mysql-test/r/func_time.result b/mysql-test/r/func_time.result index 5d40a0ed01f..fdb4a0c5996 100644 --- a/mysql-test/r/func_time.result +++ b/mysql-test/r/func_time.result @@ -847,3 +847,28 @@ timestampdiff(year,'2004-02-28','2005-02-28') select timestampdiff(year,'2004-02-29','2005-02-28'); timestampdiff(year,'2004-02-29','2005-02-28') 0 +CREATE TABLE t1 (id int NOT NULL PRIMARY KEY, day date); +CREATE TABLE t2 (id int NOT NULL PRIMARY KEY, day date); +INSERT INTO t1 VALUES +(1, '2005-06-01'), (2, '2005-02-01'), (3, '2005-07-01'); +INSERT INTO t2 VALUES +(1, '2005-08-01'), (2, '2005-06-15'), (3, '2005-07-15'); +SELECT * FROM t1, t2 +WHERE t1.day BETWEEN +'2005.09.01' - INTERVAL 6 MONTH AND t2.day; +id day id day +1 2005-06-01 1 2005-08-01 +3 2005-07-01 1 2005-08-01 +1 2005-06-01 2 2005-06-15 +1 2005-06-01 3 2005-07-15 +3 2005-07-01 3 2005-07-15 +SELECT * FROM t1, t2 +WHERE CAST(t1.day AS DATE) BETWEEN +'2005.09.01' - INTERVAL 6 MONTH AND t2.day; +id day id day +1 2005-06-01 1 2005-08-01 +3 2005-07-01 1 2005-08-01 +1 2005-06-01 2 2005-06-15 +1 2005-06-01 3 2005-07-15 +3 2005-07-01 3 2005-07-15 +DROP TABLE t1,t2; |