| Bug #10568 | Function 'LAST_DAY(date)' does not return NULL for invalid argument. | ||
|---|---|---|---|
| Submitted: | 12 May 2005 8:52 | Modified: | 24 Jun 2005 14:05 |
| Reporter: | Disha | ||
| Status: | Closed | ||
| Category: | Server | Severity: | S3 (Non-critical) |
| Version: | 5.0.5-beta pre-release | OS: | Microsoft Windows (Windows Server 2003) |
| Assigned to: | Ramil Kalimullin | Target Version: | |
[12 May 2005 9:13]
Hartmut Holzgraefe
Results with latest 5.0bk (on Linux) are even more strange:
mysql> select last_day('2005-00-00');
+------------------------+
| last_day('2005-00-00') |
+------------------------+
| 2005-00-58 |
+------------------------+
1 row in set (0,07 sec)
[1 Jun 2005 14:10]
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/internals/25444
[6 Jun 2005 8:27]
Ramil Kalimullin
Fixed in 5.0.7
[19 Jun 2005 11:34]
Brett Liotta
Yes, I am also having this problem on MySQL build 4.1.8-max-log running on Windows 2003
server.
Here is the query:
SELECT LAST_DAY('2005-06-31')
returns->2005-06-31
I expected: NULL (because there's only 30 days in June)
When I tried:
SELECT LAST_DAY('2005-06-32')
returns->NULL (this is correct)
I expected: NULL
Looks like a bug to me. Do I have to upgrade to 5.0.7?
[23 Jun 2005 15:42]
Jon Stephens
Thank you for your bug report. This issue has been committed to our
source repository of that product and will be incorporated into the
next release.
If necessary, you can access the source repository and build the latest
available version, including the bugfix, yourself. More information
about accessing the source trees is available at
http://www.mysql.com/doc/en/Installing_source_tree.html
Additional info:
Can the fix be backported to the 4.1 tree? Please let me know if this is possible and if
so when it has been done so I can document in the 4.1 change history. Thanks!
Documented in 5.0.7 changelog; bug closed (since originally reported only for 5.0.x).
[24 Jun 2005 11:12]
Ramil Kalimullin
the fix backported to 4.1
[24 Jun 2005 14:05]
Jon Stephens
Documented in 4.1.13 changelog; status unchanged.

Description: For 'LAST_DAY(date)' function , if used invalid argument such as '2005-00-00' does not return NULL. How to repeat: 1. delimiter // 2. create database test// 3. use test 4. set @@sql_mode='traditional'// 5. select last_day('2005-00-00')// 6. Execution of step (5) displays the result as, +------------------------+ | last_day('2005-00-00') | +------------------------+ | 2005-00-00 | +------------------------+ 1 row in set (0.00 sec) Expected Results: The function 'LAST_DAY(date)' should return NULL for such a invalid argument. Actual Results : The execution displays the result as, +------------------------+ | last_day('2005-00-00') | +------------------------+ | 2005-00-00 | +------------------------+ 1 row in set (0.00 sec)