summaryrefslogtreecommitdiff
path: root/mysql-test/t/func_time.test
diff options
context:
space:
mode:
authorAlexander Barkov <alexander.barkov@oracle.com>2012-01-12 13:02:51 +0400
committerAlexander Barkov <alexander.barkov@oracle.com>2012-01-12 13:02:51 +0400
commitcbee6f82b91af228f719e601b86492abc0ebbc6d (patch)
treee730d8a3f92a6758729971a6df7bf357592611fc /mysql-test/t/func_time.test
parent87f6756fdb7790f75271293c0b145a02fee5b8b2 (diff)
downloadmariadb-git-cbee6f82b91af228f719e601b86492abc0ebbc6d.tar.gz
BUG#13354387 - CRASH IN IN MY_DECIMAL::OPERATOR FOR VIEW AND FUNCTION UNIX_TIME
Fixing the 5.5 part (the 5.6 part will go in a separate commit soon). Problem: Item_direct_ref::get_date() incorrectly calculated its "null_value", which made UNIX_TIMESTAMP(view_column) incorrectly return NULL for a NOT NULL view_column. Fix: Make Item_direct_ref::get_date() calculate null_value in the similar way with the other methods (val_real,val_str,val_int,val_decimal): copy null_value from the referenced Item. modified: mysql-test/r/func_time.result mysql-test/t/func_time.test sql/item.cc
Diffstat (limited to 'mysql-test/t/func_time.test')
-rw-r--r--mysql-test/t/func_time.test15
1 files changed, 15 insertions, 0 deletions
diff --git a/mysql-test/t/func_time.test b/mysql-test/t/func_time.test
index 57a5a656591..d385a079f64 100644
--- a/mysql-test/t/func_time.test
+++ b/mysql-test/t/func_time.test
@@ -940,6 +940,21 @@ SELECT MONTHNAME(0), MONTHNAME(0) IS NULL, MONTHNAME(0) + 1;
--error ER_WRONG_VALUE_FOR_VAR
SET storage_engine=NULL;
+
+--echo #
+--echo # BUG#13354387 - CRASH IN IN MY_DECIMAL::OPERATOR FOR VIEW AND FUNCTION UNIX_TIMESTAMP
+--echo # Part1 (5.5)
+SET time_zone='+03:00';
+CREATE TABLE t1 (a DATETIME NOT NULL);
+INSERT INTO t1 VALUES ('2009-09-20 07:32:39.06');
+INSERT INTO t1 VALUES ('0000-00-00 00:00:00.00');
+CREATE VIEW v1 AS SELECT * FROM t1;
+SELECT CAST(UNIX_TIMESTAMP(a) AS DECIMAL(25,3)) AS c1 FROM v1 ORDER BY 1;
+DROP VIEW v1;
+DROP TABLE t1;
+SET time_zone=DEFAULT;
+
+
--echo #
--echo # Bug #59686 crash in String::copy() with time data type
--echo #