summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorunknown <mhansson@dl145s.mysql.com>2007-10-09 15:27:38 +0200
committerunknown <mhansson@dl145s.mysql.com>2007-10-09 15:27:38 +0200
commit91415775968a5605cbae69fcddcd9936d54b3f81 (patch)
tree7fe7add533ba41dc80b9dab5fdf0399edacd0e19
parent177d3c3c6aa28a8707988ccdd165c3affb986bf7 (diff)
parent05903b333f1a783d2f4b1cdc94a1476c23b882b9 (diff)
downloadmariadb-git-91415775968a5605cbae69fcddcd9936d54b3f81.tar.gz
Merge martin@mhansson.mysql.internal:/home/martin/mysql/src/bug31160/my51-bug31160
into dl145s.mysql.com:/data0/mhansson/bug31160/my51-bug31160
-rw-r--r--mysql-test/r/func_sapdb.result2
-rw-r--r--mysql-test/r/func_time.result9
-rw-r--r--mysql-test/t/func_time.test10
-rw-r--r--sql/item_timefunc.h5
4 files changed, 24 insertions, 2 deletions
diff --git a/mysql-test/r/func_sapdb.result b/mysql-test/r/func_sapdb.result
index b7dbfc670a8..e68a4cef1ae 100644
--- a/mysql-test/r/func_sapdb.result
+++ b/mysql-test/r/func_sapdb.result
@@ -196,7 +196,7 @@ f2 datetime YES NULL
f3 time YES NULL
f4 time YES NULL
f5 time YES NULL
-f6 time NO 00:00:00
+f6 time YES NULL
f7 datetime YES NULL
f8 date YES NULL
f9 time YES NULL
diff --git a/mysql-test/r/func_time.result b/mysql-test/r/func_time.result
index 3105bc3b578..a355d7929b5 100644
--- a/mysql-test/r/func_time.result
+++ b/mysql-test/r/func_time.result
@@ -1027,6 +1027,15 @@ fmtddate field2
Sep-4 12:00AM abcd
DROP TABLE testBug8868;
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)
union
(select time_format(timediff(now(), DATE_SUB(now(),INTERVAL 5 DAY)),'%H') As H);
diff --git a/mysql-test/t/func_time.test b/mysql-test/t/func_time.test
index d3346bbb880..5c1a5c2200b 100644
--- a/mysql-test/t/func_time.test
+++ b/mysql-test/t/func_time.test
@@ -548,6 +548,16 @@ DROP TABLE testBug8868;
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
#
diff --git a/sql/item_timefunc.h b/sql/item_timefunc.h
index 36556269d07..3376960aaf9 100644
--- a/sql/item_timefunc.h
+++ b/sql/item_timefunc.h
@@ -938,7 +938,10 @@ class Item_func_maketime :public Item_str_timefunc
{
public:
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);
const char *func_name() const { return "maketime"; }
};