Loading mysql-test/r/type_date.result +10 −0 Original line number Diff line number Diff line Loading @@ -136,3 +136,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; mysql-test/t/type_date.test +13 −0 Original line number Diff line number Diff line Loading @@ -136,3 +136,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; sql/item_timefunc.h +1 −1 Original line number Diff line number Diff line Loading @@ -1030,7 +1030,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); Loading Loading
mysql-test/r/type_date.result +10 −0 Original line number Diff line number Diff line Loading @@ -136,3 +136,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;
mysql-test/t/type_date.test +13 −0 Original line number Diff line number Diff line Loading @@ -136,3 +136,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;
sql/item_timefunc.h +1 −1 Original line number Diff line number Diff line Loading @@ -1030,7 +1030,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); Loading