Details
-
Bug
-
Status: Open (View Workflow)
-
Major
-
Resolution: Unresolved
-
None
-
None
Description
MariaDB supports dates with zero-components:
MariaDB [(none)]> SELECT @@sql_mode; |
+------------+ |
| @@sql_mode |
|
+------------+ |
| |
|
+------------+ |
1 row in set (0.000 sec) |
|
|
MariaDB [(none)]> SELECT '2000-01-00'; |
+------------+ |
| 2000-01-00 |
|
+------------+ |
| 2000-01-00 |
|
+------------+ |
1 row in set (0.000 sec) |
Date validation is made based on the available information. For example, if the month is missing, MariaDB will only check that the day part is <= 31:
MariaDB [(none)]> SELECT DATE '2000-00-31'; |
+-------------------+ |
| DATE '2000-00-31' | |
+-------------------+ |
| 2000-00-31 |
|
+-------------------+ |
1 row in set (0.000 sec) |
|
|
MariaDB [(none)]> SELECT DATE '2000-00-32'; |
ERROR 1525 (HY000): Incorrect DATE value: '2000-00-32' |
If the month is February and the year is zero, I'd expect that the day can be 29, to accomodate leap years. But it's not the case:
MariaDB [(none)]> SELECT DATE '0000-02-29'; |
ERROR 1525 (HY000): Incorrect DATE value: '0000-02-29' |
In my opinion, this is a bug.