summaryrefslogtreecommitdiff
path: root/mysql-test/t/cast.test
diff options
context:
space:
mode:
authorunknown <evgen@moonbone.local>2007-07-20 00:06:35 +0400
committerunknown <evgen@moonbone.local>2007-07-20 00:06:35 +0400
commita131428f041cd015662240bde255d159bcc53af7 (patch)
treec289f957a8353fed4b3b04d0291bdd114445733c /mysql-test/t/cast.test
parentd0020607b324cb9e5c3f930315a4fb0c4a65239b (diff)
downloadmariadb-git-a131428f041cd015662240bde255d159bcc53af7.tar.gz
Bug#29898: Item_date_typecast::val_int doesn't reset the null_value flag.
The Item_date_typecast::val_int function doesn't reset null_value flag. This makes all values that follows the first null value to be treated as nulls and led to a wrong result. Now the Item_date_typecast::val_int function correctly sets the null_value flag for both null and non-null values. mysql-test/t/cast.test: Added a test case for the bug#29898: Item_date_typecast::val_int doesn't reset the null_value flag. mysql-test/r/cast.result: Added a test case for the bug#29898: Item_date_typecast::val_int doesn't reset the null_value flag. sql/item_timefunc.cc: Bug#29898: Item_date_typecast::val_int doesn't reset the null_value flag. Now the Item_date_typecast::val_int function correctly sets the null_value flag for both null and non-null values.
Diffstat (limited to 'mysql-test/t/cast.test')
-rw-r--r--mysql-test/t/cast.test9
1 files changed, 9 insertions, 0 deletions
diff --git a/mysql-test/t/cast.test b/mysql-test/t/cast.test
index b665eb86656..316b79efe4d 100644
--- a/mysql-test/t/cast.test
+++ b/mysql-test/t/cast.test
@@ -237,4 +237,13 @@ select hex(cast('a' as char(2) binary));
select hex(cast('a' as binary(2)));
select hex(cast('a' as char(2) binary));
+#
+# Bug#29898: Item_date_typecast::val_int doesn't reset the null_value flag.
+#
+CREATE TABLE t1 (d1 datetime);
+INSERT INTO t1(d1) VALUES ('2007-07-19 08:30:00'), (NULL),
+ ('2007-07-19 08:34:00'), (NULL), ('2007-07-19 08:36:00');
+SELECT cast(date(d1) as signed) FROM t1;
+drop table t1;
+
--echo End of 5.0 tests