diff options
author | unknown <gvb@phoenix.(none)> | 2006-01-16 15:46:37 +0100 |
---|---|---|
committer | unknown <gvb@phoenix.(none)> | 2006-01-16 15:46:37 +0100 |
commit | e5f077f79a7872147a8858d353060ee08ffa5dcd (patch) | |
tree | e2e6418d1270944554ad7bde49f79671fcd01cd2 | |
parent | 37b104b8ec45d842831c4854a3ddb3443c7bc642 (diff) | |
download | mariadb-git-e5f077f79a7872147a8858d353060ee08ffa5dcd.tar.gz |
date_formats.test:
fix for bug #15828 after review
doing val_str now before testing of null value secures the function for null values returned by dynamic functions - the fix before was incomplete andy covered constant null values
mysql-test/t/date_formats.test:
fix for bug #15828 after review
doing val_str now before testing of null value secures the function for null values returned by dynamic functions - the fix before was incomplete andy covered constant null values
-rw-r--r-- | mysql-test/r/date_formats.result | 3 | ||||
-rw-r--r-- | mysql-test/t/date_formats.test | 2 | ||||
-rw-r--r-- | sql/item_timefunc.cc | 2 |
3 files changed, 5 insertions, 2 deletions
diff --git a/mysql-test/r/date_formats.result b/mysql-test/r/date_formats.result index b2dc1f7a67b..014eeed27e7 100644 --- a/mysql-test/r/date_formats.result +++ b/mysql-test/r/date_formats.result @@ -470,3 +470,6 @@ NULL select str_to_date( NULL, 1 ); str_to_date( NULL, 1 ) NULL +select str_to_date( 1, IF(1=1,NULL,NULL) ); +str_to_date( 1, IF(1=1,NULL,NULL) ) +NULL diff --git a/mysql-test/t/date_formats.test b/mysql-test/t/date_formats.test index dd31f1509c0..78b4482a94a 100644 --- a/mysql-test/t/date_formats.test +++ b/mysql-test/t/date_formats.test @@ -274,5 +274,5 @@ drop table t1; # select str_to_date( 1, NULL ); select str_to_date( NULL, 1 ); - +select str_to_date( 1, IF(1=1,NULL,NULL) ); # End of 4.1 tests diff --git a/sql/item_timefunc.cc b/sql/item_timefunc.cc index b5a9064c960..d6b57464d59 100644 --- a/sql/item_timefunc.cc +++ b/sql/item_timefunc.cc @@ -2750,9 +2750,9 @@ void Item_func_str_to_date::fix_length_and_dec() cached_field_type= MYSQL_TYPE_STRING; max_length= MAX_DATETIME_FULL_WIDTH*MY_CHARSET_BIN_MB_MAXLEN; cached_timestamp_type= MYSQL_TIMESTAMP_NONE; + format= args[1]->val_str(&format_str); if (!args[1]->null_value && (const_item= args[1]->const_item())) { - format= args[1]->val_str(&format_str); cached_format_type= get_date_time_result_type(format->ptr(), format->length()); switch (cached_format_type) { |