summaryrefslogtreecommitdiff
path: root/mysql-test/r
diff options
context:
space:
mode:
authorAlexander Barkov <bar@mariadb.org>2015-09-23 20:42:28 +0400
committerAlexander Barkov <bar@mariadb.org>2015-09-23 20:42:28 +0400
commit3ad035f66b74284f515b2786f7d4553dba5c14a2 (patch)
tree4112fdc64b1dd77aa31389e6a92e0bda7cbaba49 /mysql-test/r
parentb9da3ba45e6a6bad152203f56af47abe79e550ad (diff)
downloadmariadb-git-3ad035f66b74284f515b2786f7d4553dba5c14a2.tar.gz
MDEV-8658 DATE(zerofill_column) and DATE(COALESCE(zerofill_column)) return different results
MDEV-8660 TIME(int_zerofill_column) returns a wrong result
Diffstat (limited to 'mysql-test/r')
-rw-r--r--mysql-test/r/func_set.result8
-rw-r--r--mysql-test/r/func_time.result13
-rw-r--r--mysql-test/r/subselect_innodb.result2
-rw-r--r--mysql-test/r/type_date.result43
-rw-r--r--mysql-test/r/type_newdecimal.result14
-rw-r--r--mysql-test/r/type_time.result53
6 files changed, 100 insertions, 33 deletions
diff --git a/mysql-test/r/func_set.result b/mysql-test/r/func_set.result
index dfc3faf3fac..96af966d367 100644
--- a/mysql-test/r/func_set.result
+++ b/mysql-test/r/func_set.result
@@ -172,8 +172,8 @@ INTERVAL( 9, 1, DATE_ADD( pk, INTERVAL pk MINUTE_SECOND ), 9, 8, 3, 5, 2, 1 )
8
8
Warnings:
-Warning 1292 Incorrect datetime value: '10'
-Warning 1292 Incorrect datetime value: '11'
+Warning 1292 Incorrect datetime value: '10' for column 'pk' at row 1
+Warning 1292 Incorrect datetime value: '11' for column 'pk' at row 2
DROP TABLE t1;
#
# End of 5.3 tests
@@ -233,8 +233,8 @@ INTERVAL( 9, 1, DATE_ADD( pk, INTERVAL pk MINUTE_SECOND ), 9, 8, 3, 5, 2, 1 )
8
8
Warnings:
-Warning 1292 Incorrect datetime value: '10'
-Warning 1292 Incorrect datetime value: '11'
+Warning 1292 Incorrect datetime value: '10' for column 'pk' at row 1
+Warning 1292 Incorrect datetime value: '11' for column 'pk' at row 2
DROP TABLE t1;
#
# End of 5.3 tests
diff --git a/mysql-test/r/func_time.result b/mysql-test/r/func_time.result
index 043350ce022..c0cf6d45ae2 100644
--- a/mysql-test/r/func_time.result
+++ b/mysql-test/r/func_time.result
@@ -1834,25 +1834,14 @@ select last_day(f2) from t1;
last_day(f2)
NULL
NULL
-Warnings:
-Warning 1292 Incorrect datetime value: '0'
-Warning 1292 Incorrect datetime value: '0'
select last_day(f2) from t1 where last_day(f2) is null;
last_day(f2)
NULL
NULL
-Warnings:
-Warning 1292 Incorrect datetime value: '0'
-Warning 1292 Incorrect datetime value: '0'
-Warning 1292 Incorrect datetime value: '0'
-Warning 1292 Incorrect datetime value: '0'
select * from t1 order by last_day (f2);
f2
0
0
-Warnings:
-Warning 1292 Incorrect datetime value: '0'
-Warning 1292 Incorrect datetime value: '0'
drop table t1;
SET timestamp=unix_timestamp('2001-02-03 10:20:30');
select convert_tz(timediff('0000-00-00 00:00:00', cast('2008-03-26 07:09:06' as datetime)), 'UTC', 'Europe/Moscow');
@@ -1908,8 +1897,6 @@ insert ignore t1 values ('04:38:11','0000-00-00 00:00:00',0,'0000-00-00 00:00:00
select least(greatest(f3, f2, f4), f5) from t1;
least(greatest(f3, f2, f4), f5)
0000-00-00 00:00:00
-Warnings:
-Warning 1292 Incorrect datetime value: '0'
drop table t1;
select day(coalesce(null));
day(coalesce(null))
diff --git a/mysql-test/r/subselect_innodb.result b/mysql-test/r/subselect_innodb.result
index 07d00e96549..cfbe5d41418 100644
--- a/mysql-test/r/subselect_innodb.result
+++ b/mysql-test/r/subselect_innodb.result
@@ -296,8 +296,6 @@ INSERT INTO t1 VALUES ('2011-05-13', 0);
SELECT * FROM t1 WHERE b < (SELECT CAST(a as date) FROM t1 GROUP BY a);
a b
2011-05-13 0
-Warnings:
-Warning 1292 Incorrect datetime value: '0'
DROP TABLE t1;
#
# Bug #11766300 59387: FAILING ASSERTION: CURSOR->POS_STATE == 1997660512 (BTR_PCUR_IS_POSITIONE
diff --git a/mysql-test/r/type_date.result b/mysql-test/r/type_date.result
index 155918ccbb7..1de9b989887 100644
--- a/mysql-test/r/type_date.result
+++ b/mysql-test/r/type_date.result
@@ -759,5 +759,48 @@ Warnings:
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (coalesce(`test`.`t1`.`a`) = DATE'2001-01-01')
DROP TABLE t1;
#
+# MDEV-8658 DATE(zerofill_column) and DATE(COALESCE(zerofill_column)) return different results
+#
+CREATE TABLE t1 (a INT(6) ZEROFILL, b DECIMAL(6) ZEROFILL, c DOUBLE(6,0) ZEROFILL);
+INSERT INTO t1 VALUES (1,1,1);
+INSERT INTO t1 VALUES (10101,10101,10101);
+SELECT DATE(a), DATE(b), DATE(c) FROM t1;
+DATE(a) DATE(b) DATE(c)
+NULL NULL NULL
+2001-01-01 2001-01-01 2001-01-01
+Warnings:
+Warning 1292 Incorrect datetime value: '1' for column 'a' at row 1
+Warning 1292 Incorrect datetime value: '1' for column 'b' at row 1
+Warning 1292 Incorrect datetime value: '1' for column 'c' at row 1
+SELECT DATE(COALESCE(a)), DATE(COALESCE(b)), DATE(COALESCE(c)) FROM t1;
+DATE(COALESCE(a)) DATE(COALESCE(b)) DATE(COALESCE(c))
+NULL NULL NULL
+2001-01-01 2001-01-01 2001-01-01
+Warnings:
+Warning 1292 Incorrect datetime value: '1'
+Warning 1292 Incorrect datetime value: '1'
+Warning 1292 Incorrect datetime value: '1'
+DROP TABLE t1;
+CREATE TABLE t1 (a INT(6), b DECIMAL(6), c DOUBLE(6,0));
+INSERT INTO t1 VALUES (1,1,1);
+INSERT INTO t1 VALUES (10101,10101,10101);
+SELECT DATE(a), DATE(b), DATE(c) FROM t1;
+DATE(a) DATE(b) DATE(c)
+NULL NULL NULL
+2001-01-01 2001-01-01 2001-01-01
+Warnings:
+Warning 1292 Incorrect datetime value: '1' for column 'a' at row 1
+Warning 1292 Incorrect datetime value: '1' for column 'b' at row 1
+Warning 1292 Incorrect datetime value: '1' for column 'c' at row 1
+SELECT DATE(COALESCE(a)), DATE(COALESCE(b)), DATE(COALESCE(c)) FROM t1;
+DATE(COALESCE(a)) DATE(COALESCE(b)) DATE(COALESCE(c))
+NULL NULL NULL
+2001-01-01 2001-01-01 2001-01-01
+Warnings:
+Warning 1292 Incorrect datetime value: '1'
+Warning 1292 Incorrect datetime value: '1'
+Warning 1292 Incorrect datetime value: '1'
+DROP TABLE t1;
+#
# End of 10.1 tests
#
diff --git a/mysql-test/r/type_newdecimal.result b/mysql-test/r/type_newdecimal.result
index b498910f13c..13da89e0061 100644
--- a/mysql-test/r/type_newdecimal.result
+++ b/mysql-test/r/type_newdecimal.result
@@ -2042,33 +2042,19 @@ SELECT t1.* FROM t1 JOIN t2 USING(a);
a
10:20:30.000000
10:20:30.000000
-Warnings:
-Note 1292 Truncated incorrect time value: '102030.0000000000'
-Note 1292 Truncated incorrect time value: '102030.0000000010'
SELECT t1.* FROM t1 LEFT JOIN t2 USING(a);
a
10:20:30.000000
10:20:30.000000
-Warnings:
-Note 1292 Truncated incorrect time value: '102030.0000000000'
-Note 1292 Truncated incorrect time value: '102030.0000000000'
-Note 1292 Truncated incorrect time value: '102030.0000000010'
ALTER TABLE t2 ADD PRIMARY KEY(a);
SELECT t1.* FROM t1 JOIN t2 USING(a);
a
10:20:30.000000
10:20:30.000000
-Warnings:
-Note 1292 Truncated incorrect time value: '102030.0000000000'
-Note 1292 Truncated incorrect time value: '102030.0000000010'
SELECT t1.* FROM t1 LEFT JOIN t2 USING(a);
a
10:20:30.000000
10:20:30.000000
-Warnings:
-Note 1292 Truncated incorrect time value: '102030.0000000000'
-Note 1292 Truncated incorrect time value: '102030.0000000000'
-Note 1292 Truncated incorrect time value: '102030.0000000010'
# t2 should NOT be eliminated
EXPLAIN SELECT t1.* FROM t1 LEFT JOIN t2 USING(a);
id select_type table type possible_keys key key_len ref rows Extra
diff --git a/mysql-test/r/type_time.result b/mysql-test/r/type_time.result
index ba40fbf774b..59de00fa416 100644
--- a/mysql-test/r/type_time.result
+++ b/mysql-test/r/type_time.result
@@ -1153,5 +1153,58 @@ SELECT * FROM t1 WHERE a>TIME('00:00:00');
a
DROP TABLE t1;
#
+# MDEV-8660 TIME(int_zerofill_column) returns a wrong result
+#
+CREATE TABLE t1 (a BIGINT(15), b BIGINT(15) ZEROFILL);
+INSERT INTO t1 VALUES (9,9);
+SELECT TIME(a),TIME(b) FROM t1;
+TIME(a) TIME(b)
+00:00:09 00:00:09
+DROP TABLE t1;
+CREATE TABLE t1 (a BIGINT);
+INSERT INTO t1 VALUES (-9223372036854775808);
+SELECT CAST(a AS TIME), CAST(-9223372036854775808 AS TIME) FROM t1;
+CAST(a AS TIME) CAST(-9223372036854775808 AS TIME)
+-838:59:59 -838:59:59
+Warnings:
+Warning 1292 Incorrect time value: '-9223372036854775808' for column 'a' at row 1
+Warning 1292 Truncated incorrect time value: '-9223372036854775808'
+DROP TABLE t1;
+CREATE TABLE t1 (a INT, b DECIMAL, c DOUBLE);
+INSERT INTO t1 VALUES (-9000000,-9000000,-9000000);
+INSERT INTO t1 VALUES (-1,-1,-1);
+INSERT INTO t1 VALUES (0,0,0),(1,1,1),(9,9,9);
+INSERT INTO t1 VALUES (9000000,9000000,9000000);
+SELECT a, TIME(a),TIME(b),TIME(c) FROM t1 ORDER BY a;
+a TIME(a) TIME(b) TIME(c)
+-9000000 -838:59:59 -838:59:59 -838:59:59.999999
+-1 -00:00:01 -00:00:01 -00:00:01.000000
+0 00:00:00 00:00:00 00:00:00.000000
+1 00:00:01 00:00:01 00:00:01.000000
+9 00:00:09 00:00:09 00:00:09.000000
+9000000 838:59:59 838:59:59 838:59:59.999999
+Warnings:
+Warning 1292 Incorrect time value: '-9000000' for column 'a' at row 1
+Warning 1292 Incorrect time value: '-9000000' for column 'b' at row 1
+Warning 1292 Incorrect time value: '-9000000' for column 'c' at row 1
+Warning 1292 Incorrect time value: '9000000' for column 'a' at row 6
+Warning 1292 Incorrect time value: '9000000' for column 'b' at row 6
+Warning 1292 Incorrect time value: '9000000' for column 'c' at row 6
+DROP TABLE t1;
+CREATE TABLE t1 (a INT, b DECIMAL, c DOUBLE);
+INSERT INTO t1 VALUES (0,0,0),(1,1,1),(9,9,9);
+INSERT INTO t1 VALUES (9000000,9000000,9000000);
+SELECT a, TIME(a),TIME(b),TIME(c) FROM t1 ORDER BY a;
+a TIME(a) TIME(b) TIME(c)
+0 00:00:00 00:00:00 00:00:00.000000
+1 00:00:01 00:00:01 00:00:01.000000
+9 00:00:09 00:00:09 00:00:09.000000
+9000000 838:59:59 838:59:59 838:59:59.999999
+Warnings:
+Warning 1292 Incorrect time value: '9000000' for column 'a' at row 4
+Warning 1292 Incorrect time value: '9000000' for column 'b' at row 4
+Warning 1292 Incorrect time value: '9000000' for column 'c' at row 4
+DROP TABLE t1;
+#
# End of 10.1 tests
#