Commit 85db4f23 authored by Sergey Glukhov's avatar Sergey Glukhov

5.1 -> 5.5 merge

parents 65b3ba15 afc5d19d
...@@ -1365,6 +1365,18 @@ SET GLOBAL SQL_MODE=DEFAULT; ...@@ -1365,6 +1365,18 @@ SET GLOBAL SQL_MODE=DEFAULT;
SELECT FORMAT(YEAR(STR_TO_DATE('',GET_FORMAT(TIME,''))),1); SELECT FORMAT(YEAR(STR_TO_DATE('',GET_FORMAT(TIME,''))),1);
FORMAT(YEAR(STR_TO_DATE('',GET_FORMAT(TIME,''))),1) FORMAT(YEAR(STR_TO_DATE('',GET_FORMAT(TIME,''))),1)
NULL NULL
#
# Bug#11766126 59166: ANOTHER DATETIME VALGRIND UNINITIALIZED WARNING
#
SELECT CAST((MONTH(FROM_UNIXTIME(@@GLOBAL.SQL_MODE))) AS BINARY(1025));
CAST((MONTH(FROM_UNIXTIME(@@GLOBAL.SQL_MODE))) AS BINARY(1025))
NULL
#
# Bug#11766124 59164: VALGRIND: UNINITIALIZED VALUE IN NUMBER_TO_DATETIME
#
SELECT ADDDATE(MONTH(FROM_UNIXTIME(NULL)),INTERVAL 1 HOUR);
ADDDATE(MONTH(FROM_UNIXTIME(NULL)),INTERVAL 1 HOUR)
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.
......
...@@ -882,6 +882,18 @@ SET GLOBAL SQL_MODE=DEFAULT; ...@@ -882,6 +882,18 @@ SET GLOBAL SQL_MODE=DEFAULT;
SELECT FORMAT(YEAR(STR_TO_DATE('',GET_FORMAT(TIME,''))),1); SELECT FORMAT(YEAR(STR_TO_DATE('',GET_FORMAT(TIME,''))),1);
--echo #
--echo # Bug#11766126 59166: ANOTHER DATETIME VALGRIND UNINITIALIZED WARNING
--echo #
SELECT CAST((MONTH(FROM_UNIXTIME(@@GLOBAL.SQL_MODE))) AS BINARY(1025));
--echo #
--echo # Bug#11766124 59164: VALGRIND: UNINITIALIZED VALUE IN NUMBER_TO_DATETIME
--echo #
SELECT ADDDATE(MONTH(FROM_UNIXTIME(NULL)),INTERVAL 1 HOUR);
--echo End of 5.1 tests --echo End of 5.1 tests
--echo # --echo #
......
...@@ -997,8 +997,12 @@ bool Item::get_date(MYSQL_TIME *ltime,uint fuzzydate) ...@@ -997,8 +997,12 @@ bool Item::get_date(MYSQL_TIME *ltime,uint fuzzydate)
} }
else else
{ {
longlong value= val_int();
int was_cut; int was_cut;
longlong value= val_int();
if (null_value)
goto err;
if (number_to_datetime(value, ltime, fuzzydate, &was_cut) == LL(-1)) if (number_to_datetime(value, ltime, fuzzydate, &was_cut) == LL(-1))
{ {
char buff[22], *end; char buff[22], *end;
......
...@@ -144,8 +144,11 @@ class Item_func_month :public Item_func ...@@ -144,8 +144,11 @@ class Item_func_month :public Item_func
{ DBUG_ASSERT(fixed == 1); return (double) Item_func_month::val_int(); } { DBUG_ASSERT(fixed == 1); return (double) Item_func_month::val_int(); }
String *val_str(String *str) String *val_str(String *str)
{ {
str->set(val_int(), collation.collation); longlong nr= val_int();
return null_value ? 0 : str; if (null_value)
return 0;
str->set(nr, collation.collation);
return str;
} }
const char *func_name() const { return "month"; } const char *func_name() const { return "month"; }
enum Item_result result_type () const { return INT_RESULT; } enum Item_result result_type () const { return INT_RESULT; }
......
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