| Bug #83463 | str_to_date() accepts and returns invalid dates | ||
|---|---|---|---|
| Submitted: | 20 Oct 2016 15:05 | Modified: | 21 Oct 2016 7:33 |
| Reporter: | Anselmo Canfora | Email Updates: | |
| Status: | Verified | Impact on me: | |
| Category: | MySQL Server: DML | Severity: | S2 (Serious) |
| Version: | 5.6.31, 5.5.53, 5.6.34, 5.7.16 | OS: | CentOS (CentOS release 6.6 (Final)) |
| Assigned to: | CPU Architecture: | Any | |
[21 Oct 2016 7:33]
MySQL Verification Team
Hello Anselmo Canfora, Thank you for the report and feedback! Thanks, Umesh

Description: select str_to_date('2017-02-31', '%Y-%m-%d'); MySQL returns 2017-03-03 furthermore: select date_format(str_to_date('2017-02-31', '%Y-%m-%d'), '%Y-%m-%d'); returns back 2017-02-31 this means probably: - you perform only BASIC checks on days being < 32 - you don't store internally the date as 64 bit integer How to repeat: Issue above queries. Suggested fix: Implement more robust date consistency checks.