Commit c7ff5062 authored by mhansson@dl145s.mysql.com's avatar mhansson@dl145s.mysql.com

Merge martin@mhansson.mysql.internal:/home/martin/mysql/src/bug31160/my50-bug31160

into  dl145s.mysql.com:/data0/mhansson/bug31160/my50-bug31160
parents 1ab2fd9b 148ce22a
...@@ -196,7 +196,7 @@ f2 datetime YES NULL ...@@ -196,7 +196,7 @@ f2 datetime YES NULL
f3 time YES NULL f3 time YES NULL
f4 time YES NULL f4 time YES NULL
f5 time YES NULL f5 time YES NULL
f6 time NO 00:00:00 f6 time YES NULL
f7 datetime YES NULL f7 datetime YES NULL
f8 date YES NULL f8 date YES NULL
f9 time YES NULL f9 time YES NULL
......
...@@ -1027,6 +1027,15 @@ fmtddate field2 ...@@ -1027,6 +1027,15 @@ fmtddate field2
Sep-4 12:00AM abcd Sep-4 12:00AM abcd
DROP TABLE testBug8868; DROP TABLE testBug8868;
SET NAMES DEFAULT; SET NAMES DEFAULT;
CREATE TABLE t1 (
a TIMESTAMP
);
INSERT INTO t1 VALUES (now()), (now());
SELECT 1 FROM t1 ORDER BY MAKETIME(1, 1, a);
1
1
1
DROP TABLE t1;
(select time_format(timediff(now(), DATE_SUB(now(),INTERVAL 5 DAY)),'%H') As H) (select time_format(timediff(now(), DATE_SUB(now(),INTERVAL 5 DAY)),'%H') As H)
union union
(select time_format(timediff(now(), DATE_SUB(now(),INTERVAL 5 DAY)),'%H') As H); (select time_format(timediff(now(), DATE_SUB(now(),INTERVAL 5 DAY)),'%H') As H);
......
...@@ -545,6 +545,16 @@ DROP TABLE testBug8868; ...@@ -545,6 +545,16 @@ DROP TABLE testBug8868;
SET NAMES DEFAULT; SET NAMES DEFAULT;
#
# Bug #31160: MAKETIME() crashes server when returning NULL in ORDER BY using
# filesort
#
CREATE TABLE t1 (
a TIMESTAMP
);
INSERT INTO t1 VALUES (now()), (now());
SELECT 1 FROM t1 ORDER BY MAKETIME(1, 1, a);
DROP TABLE t1;
# #
# Bug #19844 time_format in Union truncates values # Bug #19844 time_format in Union truncates values
......
...@@ -962,7 +962,10 @@ class Item_func_maketime :public Item_str_timefunc ...@@ -962,7 +962,10 @@ class Item_func_maketime :public Item_str_timefunc
{ {
public: public:
Item_func_maketime(Item *a, Item *b, Item *c) Item_func_maketime(Item *a, Item *b, Item *c)
:Item_str_timefunc(a, b ,c) {} :Item_str_timefunc(a, b, c)
{
maybe_null= TRUE;
}
String *val_str(String *str); String *val_str(String *str);
const char *func_name() const { return "maketime"; } const char *func_name() const { return "maketime"; }
}; };
......
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