Skip to content

Commit 6fea92a

Browse files
author
ramil/ram@myoffice.izhnet.ru
committed
Merge mysql.com:/usr/home/ram/work/bug23938/my50-bug23938
into mysql.com:/usr/home/ram/work/bug23938/my51-bug23938
2 parents 6e3f6b0 + f103fde commit 6fea92a

File tree

3 files changed

+14
-1
lines changed

3 files changed

+14
-1
lines changed

mysql-test/r/cast.result

+4
Original file line numberDiff line numberDiff line change
@@ -348,6 +348,10 @@ Warnings:
348348
Warning 1292 Truncated incorrect INTEGER value: '-1e+30'
349349
Warning 1292 Truncated incorrect INTEGER value: '1e+30'
350350
DROP TABLE t1;
351+
select isnull(date(NULL)), isnull(cast(NULL as DATE));
352+
isnull(date(NULL)) isnull(cast(NULL as DATE))
353+
1 1
354+
End of 4.1 tests
351355
select cast('1.2' as decimal(3,2));
352356
cast('1.2' as decimal(3,2))
353357
1.20

mysql-test/t/cast.test

+7-1
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,13 @@ INSERT INTO t1 SET f1 = +1.0e+30 ;
176176
SELECT f1 AS double_val, CAST(f1 AS SIGNED INT) AS cast_val FROM t1;
177177
DROP TABLE t1;
178178

179-
# End of 4.1 tests
179+
#
180+
# Bug #23938: cast(NULL as DATE)
181+
#
182+
183+
select isnull(date(NULL)), isnull(cast(NULL as DATE));
184+
185+
--echo End of 4.1 tests
180186

181187

182188
#decimal-related additions

sql/item_timefunc.cc

+3
Original file line numberDiff line numberDiff line change
@@ -2542,7 +2542,10 @@ longlong Item_date_typecast::val_int()
25422542
DBUG_ASSERT(fixed == 1);
25432543
TIME ltime;
25442544
if (args[0]->get_date(&ltime, TIME_FUZZY_DATE))
2545+
{
2546+
null_value= 1;
25452547
return 0;
2548+
}
25462549
return (longlong) (ltime.year * 10000L + ltime.month * 100 + ltime.day);
25472550
}
25482551

0 commit comments

Comments
 (0)