| Bug #1730 | DATE Data constrain | ||
|---|---|---|---|
| Submitted: | 1 Nov 2003 0:55 | Modified: | 4 Oct 2005 11:58 |
| Reporter: | Giuliano Lotta | Email Updates: | |
| Status: | Closed | Impact on me: | |
| Category: | MySQL Server | Severity: | S4 (Feature request) |
| Version: | 4.0.16 | OS: | Windows (Windows 2000) |
| Assigned to: | CPU Architecture: | Any | |
[1 Nov 2003 8:01]
Dean Ellis
I am changing this to a Feature Request, as MySQL's limited validity testing on date values is documented behaviour. You may read more about it here: http://www.mysql.com/doc/en/Using_DATE.html Thank you
[4 Oct 2005 11:58]
Hartmut Holzgraefe
In 4.1 you'll get at least a warning when trying to insert impossible values, in 5.0 you can even force errors with "sql_mode=TRADITIONAL"

Description: Create a table (MyIsam, InnoDB,...) with a DATE field. Enter in the date filed a _wrong_ date: 2003-11-31 (!) 2003-02-30 (!!) 2003-02-31 (!!!) the server (mysql-max) accept it like it would be a valid date !! Giuliano Lotta How to repeat: For creating the table an check the error I used che control center 0.9.3 beta Just follow the description. Suggested fix: The only check is done in the present realese, is if the month is littler/equal of 12, and il the day is littler/equal of 31, for ALL the months !! Is should at least be checked relations between day<-> month, i.e. a few lines code like: siwtch { case february: ; case november, april, june, september: default: ; }; or better a code that implement a check boudary also on february/bisestile years !!