Bug #27014 Imperfect error/warning message for STR_TO_DATE for invalid datetime value

Submitted: 9 Mar 2007 21:03 Modified: 4 Sep 2007 18:22
Reporter: Roland Bouman Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Errors Severity:S3 (Non-critical)
Version:5.1.16, 5.0.27 OS:Linux (linux)
Assigned to: Timothy Smith CPU Architecture:Any
Tags: STR_TO_DATE

[9 Mar 2007 21:03] Roland Bouman
Description:
When STR_TO_DATE is offered an argument value that cannot be parsed using the argument formatstring, a warning (or error depending on the sql_mode) is returned. However, the message refers to the function "str_to_time". That is incorrect and should be str_to_date.

How to repeat:
(%k is invalid in comination with %p and provokes the error)

select str_to_date(date_format(now(),'%b %e, %Y %k:%i%p'),'%b %e, %Y %k:%i%p');
+-------------------------------------------------------------------------+
| str_to_date(date_format(now(),'%b %e, %Y %k:%i%p'),'%b %e, %Y %k:%i%p') |
+-------------------------------------------------------------------------+
| NULL                                                                    |
+-------------------------------------------------------------------------+
1 row in set, 1 warning (0.00 sec)

Error (Code 1411): Incorrect datetime value: 'Mar 9, 2007 21:49PM' for function str_to_time

Suggested fix:
Please make the message read "str_to_date" instead of "str_to_time"
[10 Mar 2007 7:56] Valeriy Kravchuk
Thank you for a bug report. Verified just as described. 5.0.27 returns the same error message.
[15 Mar 2007 20:54] Konstantin Osipov
Suggested fix: extend extract_datetime with another parameter, "const char *function_name"
[31 Aug 2007 5:59] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/33504

ChangeSet@1.2595, 2007-08-30 23:57:39-06:00, tsmith@ramayana.hindu.god +1 -0
  Bug #27014: Imperfect error/warning message for STR_TO_DATE for invalid datetime value
  
  Fix name of function in warning message.
[31 Aug 2007 7:31] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/33508

ChangeSet@1.2596, 2007-08-31 01:28:42-06:00, tsmith@ramayana.hindu.god +1 -0
  Fix test results for bug #27014
[31 Aug 2007 11:24] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/33523

ChangeSet@1.2597, 2007-08-31 05:21:12-06:00, tsmith@ramayana.hindu.god +1 -0
  Correct test result file for bug #27014
[4 Sep 2007 17:11] Bugs System
Pushed into 5.1.23-beta
[4 Sep 2007 18:22] Paul DuBois
Noted in 5.1.23 changelog.

STR_TO_DATE() displayed an error message that referred to
STR_TO_TIME().

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.043 sec. using MySQL 8.4.7-u6-cloud

Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.