Bug #47140 | curdate() -1 doesn't work on first day of the month | ||
---|---|---|---|
Submitted: | 4 Sep 2009 13:58 | Modified: | 10 Sep 2009 6:44 |
Reporter: | Frank van de Pasch | Email Updates: | |
Status: | Not a Bug | Impact on me: | |
Category: | MySQL Server: General | Severity: | S3 (Non-critical) |
Version: | 5.1.37 | OS: | Windows (2003) |
Assigned to: | CPU Architecture: | Any |
[4 Sep 2009 13:58]
Frank van de Pasch
[4 Sep 2009 14:04]
Frank van de Pasch
In the section "How to repeat" I wrote: "On the first day of the month execute a query with curdate() - 1 in the where clause of a SQL query." I meant "On the first day of the next month execute a query with curdate() - 1 in the where clause of a SQL query."
[4 Sep 2009 15:22]
MySQL Verification Team
Thank you for a bug report. Could you please provide a repeatable test case with a dump file (create tables, insert command), the output of your queries, the expected result and the my.ini. Thanks in advance.
[7 Sep 2009 17:11]
Sergei Golubchik
You do date arithmetics incorrectly, see http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html for details.
[8 Sep 2009 5:48]
Frank van de Pasch
Hello Sergei, sorry I don't see what's wrong with the date function in my query compared with the function in the manual. Could you be more specific? Thanks, Frank
[8 Sep 2009 13:04]
Frank van de Pasch
Hello support, attached the my.ini file. Also attached a file with the DDL statements you asked for. When you execute the query on the first of oktober at 1:15 AM you can reproduce the problem. Kind regards, Frank
[9 Sep 2009 17:21]
Sergei Golubchik
you cannot write date + 1, it won't work as you expect. See the manual for DATE_ADD and DATE_SUB functions
[10 Sep 2009 6:44]
Frank van de Pasch
Hello support, So you say that the below statement is correct to select current day - 1? date_add(curdate(), interval -1, day) In the manual I can also see that there are arithmetics with the curdate() function so I don't see what the problem is. Also strange is that the function curdate() - 1 perfectly works for every day in the month except when the last day of the month is selected. Kind regards, Frank
[10 Sep 2009 8:54]
Sergei Golubchik
We're sorry, but the bug system is not the appropriate forum for asking help on using MySQL products. Your problem is not the result of a bug. Support on using our products is available both free in our forums at http://forums.mysql.com/ and for a reasonable fee direct from our skilled support engineers at http://www.mysql.com/support/ Thank you for your interest in MySQL.