Commit 8cca70e0 authored by Sergey Glukhov's avatar Sergey Glukhov

5.1 -> 5.5 merge

parents b9b40a0c 47885f55
...@@ -1353,6 +1353,18 @@ DROP TABLE t1; ...@@ -1353,6 +1353,18 @@ DROP TABLE t1;
SELECT STR_TO_DATE(SPACE(2),'1'); SELECT STR_TO_DATE(SPACE(2),'1');
STR_TO_DATE(SPACE(2),'1') STR_TO_DATE(SPACE(2),'1')
0000-00-00 0000-00-00
#
# Bug#11765216 58154: UNINITIALIZED VARIABLE FORMAT IN STR_TO_DATE FUNCTION
#
SET GLOBAL SQL_MODE='';
DO STR_TO_DATE((''), FROM_DAYS(@@GLOBAL.SQL_MODE));
SET GLOBAL SQL_MODE=DEFAULT;
#
# Bug#11766087 59125: VALGRIND UNINITIALISED VALUE WARNING IN ULL2DEC, LONGLONG2DECIMAL
#
SELECT FORMAT(YEAR(STR_TO_DATE('',GET_FORMAT(TIME,''))),1);
FORMAT(YEAR(STR_TO_DATE('',GET_FORMAT(TIME,''))),1)
NULL
End of 5.1 tests End of 5.1 tests
# #
# Bug#57039: constant subtime expression returns incorrect result. # Bug#57039: constant subtime expression returns incorrect result.
......
...@@ -868,6 +868,20 @@ DROP TABLE t1; ...@@ -868,6 +868,20 @@ DROP TABLE t1;
SELECT STR_TO_DATE(SPACE(2),'1'); SELECT STR_TO_DATE(SPACE(2),'1');
--echo #
--echo # Bug#11765216 58154: UNINITIALIZED VARIABLE FORMAT IN STR_TO_DATE FUNCTION
--echo #
SET GLOBAL SQL_MODE='';
DO STR_TO_DATE((''), FROM_DAYS(@@GLOBAL.SQL_MODE));
SET GLOBAL SQL_MODE=DEFAULT;
--echo #
--echo # Bug#11766087 59125: VALGRIND UNINITIALISED VALUE WARNING IN ULL2DEC, LONGLONG2DECIMAL
--echo #
SELECT FORMAT(YEAR(STR_TO_DATE('',GET_FORMAT(TIME,''))),1);
--echo End of 5.1 tests --echo End of 5.1 tests
--echo # --echo #
......
...@@ -505,7 +505,10 @@ bool Item_func::is_expensive_processor(uchar *arg) ...@@ -505,7 +505,10 @@ bool Item_func::is_expensive_processor(uchar *arg)
my_decimal *Item_func::val_decimal(my_decimal *decimal_value) my_decimal *Item_func::val_decimal(my_decimal *decimal_value)
{ {
DBUG_ASSERT(fixed); DBUG_ASSERT(fixed);
int2my_decimal(E_DEC_FATAL_ERROR, val_int(), unsigned_flag, decimal_value); longlong nr= val_int();
if (null_value)
return 0; /* purecov: inspected */
int2my_decimal(E_DEC_FATAL_ERROR, nr, unsigned_flag, decimal_value);
return decimal_value; return decimal_value;
} }
......
...@@ -3405,6 +3405,7 @@ void Item_func_str_to_date::fix_length_and_dec() ...@@ -3405,6 +3405,7 @@ void Item_func_str_to_date::fix_length_and_dec()
{ {
maybe_null= 1; maybe_null= 1;
decimals=0; decimals=0;
cached_format_type= DATE_TIME;
cached_field_type= MYSQL_TYPE_DATETIME; cached_field_type= MYSQL_TYPE_DATETIME;
max_length= MAX_DATETIME_FULL_WIDTH*MY_CHARSET_BIN_MB_MAXLEN; max_length= MAX_DATETIME_FULL_WIDTH*MY_CHARSET_BIN_MB_MAXLEN;
cached_timestamp_type= MYSQL_TIMESTAMP_NONE; cached_timestamp_type= MYSQL_TIMESTAMP_NONE;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment