Bug #71562 CAST should give warning for invalid date

Submitted: 3 Feb 2014 10:17 Modified: 16 Jan 8:40
Reporter: Daniël van Eeden Email Updates:
Status: Can't repeat Impact on me:
None 
Category:MySQL Server: DML Severity:S3 (Non-critical)
Version: OS:Any
Assigned to: CPU Architecture:Any

[3 Feb 2014 10:17] Daniël van Eeden
Description:
The CAST() function does not give any warning/error if an invalid date is supplied.

How to repeat:
mysql> SET sql_mode := 'STRICT_ALL_TABLES,NO_ZERO_DATE,NO_ZERO_IN_DATE';
Query OK, 0 rows affected (0.00 sec)

mysql> SELECT CAST('2014-00-30' AS DATE);                                                                     +----------------------------+
| CAST('2014-00-30' AS DATE) |
+----------------------------+
| 2014-00-30                 |
+----------------------------+
1 row in set (0.00 sec)

Suggested fix:
Return warning/error if the date is invalid.
[3 Feb 2014 11:36] MySQL Verification Team
Hello  Daniel,

Thank you for the bug report and test case.
Verified as described.

Thanks,
Umesh
[14 Dec 2025 19:15] Roy Lyseng
Posted by developer:
 
Not reproducible in version 8.0 and later.
[16 Jan 8:40] Daniël van Eeden
I think this can be closed

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

Page generated in 0.041 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.