summaryrefslogtreecommitdiff
path: root/mysql-test/t/func_time.test
diff options
context:
space:
mode:
authortnurnberg@mysql.com/sin.intern.azundris.com <>2007-03-02 15:23:13 +0100
committertnurnberg@mysql.com/sin.intern.azundris.com <>2007-03-02 15:23:13 +0100
commitf37267bb3c246a32ae4967f9860965cd4436abfd (patch)
tree1e2e32c8652155ce5d6b0177ee02a2b7296225b8 /mysql-test/t/func_time.test
parentab61d07a30b73e3446b6eab9536ba464a0d55f74 (diff)
downloadmariadb-git-f37267bb3c246a32ae4967f9860965cd4436abfd.tar.gz
Bug #21103: DATE column not compared as DATE
If we compare two items A and B, with B being (a constant) of a larger type, then A gets promoted to B's type for comparison if it's a constant, function, or CAST() column, but B gets demoted to A's type if A is a (not explicitly CAST()) column. This is counter-intuitive and not mandated by the standard. Disabling optimisation where it would be lossy so field value will properly get promoted and compared as binary string (rather than as integers).
Diffstat (limited to 'mysql-test/t/func_time.test')
-rw-r--r--mysql-test/t/func_time.test13
1 files changed, 13 insertions, 0 deletions
diff --git a/mysql-test/t/func_time.test b/mysql-test/t/func_time.test
index 1aa4b434a83..ab904b187a3 100644
--- a/mysql-test/t/func_time.test
+++ b/mysql-test/t/func_time.test
@@ -715,6 +715,19 @@ SET NAMES DEFAULT;
select str_to_date('10:00 PM', '%h:%i %p') + INTERVAL 10 MINUTE;
#
+# Bug #21103: DATE column not compared as DATE
+#
+
+create table t1 (field DATE);
+insert into t1 values ('2006-11-06');
+select * from t1 where field < '2006-11-06 04:08:36.0';
+select * from t1 where field = '2006-11-06 04:08:36.0';
+select * from t1 where field = '2006-11-06';
+select * from t1 where CAST(field as DATETIME) < '2006-11-06 04:08:36.0';
+select * from t1 where CAST(field as DATE) < '2006-11-06 04:08:36.0';
+drop table t1;
+
+#
# Bug #25643: SEC_TO_TIME function problem
#
CREATE TABLE t1 (a int, t1 time, t2 time, d date, PRIMARY KEY (a));