Closed
Bug 327348
Opened 19 years ago
Closed 19 years ago
Whining fails on MySQL 4.0 due to multiple date addition
Categories
(Bugzilla :: Whining, defect, P1)
Tracking
()
RESOLVED
FIXED
Bugzilla 2.20
People
(Reporter: robzilla, Assigned: goobix)
References
Details
Attachments
(1 file, 1 obsolete file)
|
2.08 KB,
patch
|
LpSolit
:
review+
Wurblzap
:
review+
|
Details | Diff | Splinter Review |
In whine.pl, near line 185 (and other places), we have sql like the following:
"UPDATE whine_schedules " .
"SET run_next = CURRENT_DATE + " .
$dbh->sql_interval('?', 'DAY') . " + " .
$dbh->sql_interval('?', 'HOUR') .
" WHERE id = ?"
When I run the whine script on MySQL 4.0.20, I get a syntax error from this statement.
It seems that MySQL doesn't like the addition of more than two dates in a single statement using standard arithmetic operators. It probably wants us to use the Date and Time arithmetic functions instead.
For example, if I change it to the following, it works:
"UPDATE whine_schedules " .
"SET run_next = DATE_ADD(CURRENT_DATE + " .
$dbh->sql_interval('?', 'DAY') . ", " .
$dbh->sql_interval('?', 'HOUR') . ") " .
" WHERE id = ?"
| Assignee | ||
Comment 2•19 years ago
|
||
Conforming with MySQL 4.0.26:
[Sun Feb 26 04:10:38 2006] whine.pl: DBD::mysql::st execute failed: You have an
error in your SQL syntax. Check the manual that corresponds to your MySQL serve
r version for the right syntax to use near 'WHERE id = '1'' at line 1 [for State
ment "UPDATE whine_schedules SET run_next = CURRENT_DATE + INTERVAL ? DAY + INTE
RVAL ? HOUR WHERE id = ?"] at whine.pl line 182
| Assignee | ||
Updated•19 years ago
|
Target Milestone: --- → Bugzilla 2.20
| Assignee | ||
Updated•19 years ago
|
Summary: whining fails on mysql 4.0 due to date addition → Whining fails on MySQL 4.0 due to date addition
Comment 3•19 years ago
|
||
We support MySQL 4.0.14, so that's a blocker.
Flags: blocking2.22?
Flags: blocking2.20.2?
| Assignee | ||
Comment 4•19 years ago
|
||
s/Conforming/Confirming/ (in my previous comment)
Reference: http://dev.mysql.com/doc/refman/4.1/en/date-and-time-functions.html
It says:
>> As of MySQL 3.23, date arithmetic also can be performed using INTERVAL together with the + or - operator:
date + INTERVAL expr type
date - INTERVAL expr type
INTERVAL expr type is allowed on either side of the + operator if the expression on the other side is a date or datetime value. <<
So according to documentation, at least the first addition should work. We can use DATE_ADD for the 2nd ones.
Assignee: erik → vladd
| Assignee | ||
Comment 5•19 years ago
|
||
Attachment #213209 -
Flags: review?
| Assignee | ||
Comment 6•19 years ago
|
||
Comment on attachment 213209 [details] [diff] [review]
Version 1, while.pl tested successfully
Since it works on 4.0, I thought LpSolit could test it on PgSQL and other MySQL releases to make sure it keeps running ok on them.
Attachment #213209 -
Flags: review? → review?(LpSolit)
| Assignee | ||
Updated•19 years ago
|
Status: NEW → ASSIGNED
Comment 7•19 years ago
|
||
Comment on attachment 213209 [details] [diff] [review]
Version 1, while.pl tested successfully
>+ "SET run_next = DATE_ADD(CURRENT_DATE + " .
>+ $dbh->sql_interval('?', 'DAY') . ", " .
>+ $dbh->sql_interval('?', 'HOUR') . ") " .
DATE_ADD() is not supported on PostgreSQL:
http://www.postgresql.org/docs/8.1/static/functions-datetime.html
I tested on my Pg 8.0.7 installation and it indeed fails.
Attachment #213209 -
Flags: review?(LpSolit) → review-
Comment 8•19 years ago
|
||
Couldn't you write "(A + B) + C" instead of "A + B + C" ?
| Assignee | ||
Comment 9•19 years ago
|
||
Yeap, ( .. ) works as well.
Attachment #213209 -
Attachment is obsolete: true
Attachment #213251 -
Flags: review?(LpSolit)
| Assignee | ||
Updated•19 years ago
|
Priority: -- → P1
Comment 10•19 years ago
|
||
Comment on attachment 213251 [details] [diff] [review]
Version 2, while.pl tested successfully
Tested successfully on MySQL 4.1.x, 5.0.x and PostgreSQL 7.4.x and 8.0.x.
Attachment #213251 -
Flags: review?(LpSolit) → review+
Updated•19 years ago
|
Flags: approval?
Flags: approval2.22?
Flags: approval2.20?
Comment 11•19 years ago
|
||
*** Bug 325813 has been marked as a duplicate of this bug. ***
Updated•19 years ago
|
Attachment #213251 -
Flags: review+
Comment 12•19 years ago
|
||
works here on bugs.gentoo.org. mysql 4.0.24.
thanks guys!
Updated•19 years ago
|
Flags: blocking2.22?
Flags: blocking2.22+
Flags: blocking2.20.2?
Flags: blocking2.20.2+
Flags: approval?
Flags: approval2.22?
Flags: approval2.22+
Flags: approval2.20?
Flags: approval2.20+
Flags: approval+
| Assignee | ||
Comment 13•19 years ago
|
||
Checking in whine.pl;
/cvsroot/mozilla/webtools/bugzilla/whine.pl,v <-- whine.pl
new revision: 1.23; previous revision: 1.22
done
Checking in whine.pl;
/cvsroot/mozilla/webtools/bugzilla/whine.pl,v <-- whine.pl
new revision: 1.22.2.1; previous revision: 1.22
done
Checking in whine.pl;
/cvsroot/mozilla/webtools/bugzilla/whine.pl,v <-- whine.pl
new revision: 1.13.2.6; previous revision: 1.13.2.5
done
Status: ASSIGNED → RESOLVED
Closed: 19 years ago
Resolution: --- → FIXED
Summary: Whining fails on MySQL 4.0 due to date addition → Whining fails on MySQL 4.0 due to multiple date addition
You need to log in
before you can comment on or make changes to this bug.
Description
•