summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormhansson/martin@linux-st28.site <>2007-10-04 10:06:33 +0200
committermhansson/martin@linux-st28.site <>2007-10-04 10:06:33 +0200
commitec959efa717da70fd6c19ce5c6eab6c27f256c14 (patch)
tree58b859f865445f55d47be9cf43fa18a4de6c0007
parent4d375e46e3a8373f565c1ae957166868c6c164a4 (diff)
parent028992ac694eaef99653f3efe0f74ace22828261 (diff)
downloadmariadb-git-ec959efa717da70fd6c19ce5c6eab6c27f256c14.tar.gz
Merge linux-st28.site:/home/martin/mysql/src/bug30942/my50-bug30942
into linux-st28.site:/home/martin/mysql/src/bug30942/my51-bug30942
-rw-r--r--mysql-test/r/type_date.result10
-rw-r--r--mysql-test/t/type_date.test13
-rw-r--r--sql/item_timefunc.h2
3 files changed, 24 insertions, 1 deletions
diff --git a/mysql-test/r/type_date.result b/mysql-test/r/type_date.result
index d6a01727813..6d84fb2aa71 100644
--- a/mysql-test/r/type_date.result
+++ b/mysql-test/r/type_date.result
@@ -145,3 +145,13 @@ d dt ts
0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00
2001-11-11 2001-11-11 00:00:00 2001-11-11 00:00:00
drop table t1;
+CREATE TABLE t1 (
+a INT
+);
+INSERT INTO t1 VALUES (1);
+INSERT INTO t1 VALUES (NULL);
+SELECT str_to_date( '', a ) FROM t1;
+str_to_date( '', a )
+0000-00-00 00:00:00
+NULL
+DROP TABLE t1;
diff --git a/mysql-test/t/type_date.test b/mysql-test/t/type_date.test
index dcee4fd2ffc..a09d3c44d62 100644
--- a/mysql-test/t/type_date.test
+++ b/mysql-test/t/type_date.test
@@ -139,3 +139,16 @@ insert into t1 values (9912101,9912101,9912101);
insert into t1 values (11111,11111,11111);
select * from t1;
drop table t1;
+
+#
+# Bug #30942: select str_to_date from derived table returns varying results
+#
+CREATE TABLE t1 (
+ a INT
+);
+
+INSERT INTO t1 VALUES (1);
+INSERT INTO t1 VALUES (NULL);
+
+SELECT str_to_date( '', a ) FROM t1;
+DROP TABLE t1;
diff --git a/sql/item_timefunc.h b/sql/item_timefunc.h
index 32f5bcf8e52..a5aeaf59b4d 100644
--- a/sql/item_timefunc.h
+++ b/sql/item_timefunc.h
@@ -1005,7 +1005,7 @@ class Item_func_str_to_date :public Item_str_func
bool const_item;
public:
Item_func_str_to_date(Item *a, Item *b)
- :Item_str_func(a, b)
+ :Item_str_func(a, b), const_item(false)
{}
String *val_str(String *str);
bool get_date(MYSQL_TIME *ltime, uint fuzzy_date);