Closed Bug 317861 Opened 19 years ago Closed 19 years ago

Sanity check is failing on from CVS: "INTERVAL" gets plunked into the query

Categories

(Bugzilla :: Bugzilla-General, defect)

x86
Linux
defect
Not set
trivial

Tracking

()

VERIFIED INVALID

People

(Reporter: pjdemarco, Unassigned)

References

()

Details

User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.10) Gecko/20050716 Firefox/1.0.6 Build Identifier: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.10) Gecko/20050716 Firefox/1.0.6 Running a sanity check I get: Software error: DBD::mysql::st execute failed: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'ORDER BY bug_id' at line 1 [for Statement "SELECT bug_id FROM bugs WHERE (lastdiffed IS NULL OR lastdiffed < delta_ts) AND delta_ts < now() - INTERVAL 30 ORDER BY bug_id"] at Bugzilla/DB.pm line 84 Bugzilla::DB::SendSQL('SELECT bug_id FROM bugs WHERE (lastdiffed IS NULL OR lastdiff...') called at /var/www/cgi-bin/bugzilla/sanitycheck.cgi line 808 For help, please send mail to the webmaster (root@localhost), giving this error message and the time and date of the error. Reproducible: Always Steps to Reproduce: Take the query from the error and put it into mysql prompt: mysql> SELECT bug_id FROM bugs WHERE (lastdiffed IS NULL OR lastdiffed < delta_ts) AND delta_ts < now() - INTERVAL 30 ORDER BY bug_id; Actual Results: ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'ORDER BY bug_id' at line 1 Expected Results: mysql> SELECT bug_id FROM bugs WHERE (lastdiffed IS NULL OR lastdiffed < delta_ts) AND delta_ts < now() - 30 ORDER BY bug_id; Empty set, 1 warning (0.00 sec)
MySQL version? Bugzilla version? Is this a Debian package?
It seems to me you've got a sanitycheck.cgi using the two-param syntax of sql_interval and a Mysql.pm supporting the one-param syntax only (assuming you're using MySQL as opposed to Pg). What Bugzilla version are you using? What does line 810 of sanitycheck.cgi contain? What does the sql_interval function in Bugzilla/DB/Mysql.pm look like?
(In reply to comment #1) > MySQL version? Bugzilla version? Is this a Debian package? mysql Ver 14.12 Distrib 5.0.15, for pc-linux-gnu (i686) using readline 5.0 bugzilla is from CVS Linux mainpc 2.6.12-1.1381_FC3 #1 Fri Oct 21 03:46:55 EDT 2005 i686 i686 i386 GNU/Linux (In reply to comment #2) > It seems to me you've got a sanitycheck.cgi using the two-param syntax of > sql_interval and a Mysql.pm supporting the one-param syntax only (assuming > you're using MySQL as opposed to Pg). > > What Bugzilla version are you using? The one from CVS > > What does line 810 of sanitycheck.cgi contain? "delta_ts < now() - " . $dbh->sql_interval(30, 'MINUTE') . > > What does the sql_interval function in Bugzilla/DB/Mysql.pm look like? > sub sql_interval { my ($self, $interval) = @_; return "INTERVAL $interval"; }
I just updated again, now the function has 3 parameters.. my sanitycheck works now. Maybe I was just inbetween someones commits. sub sql_interval { my ($self, $interval, $units) = @_; return "INTERVAL $interval $units"; } this bug can be closed.
Status: UNCONFIRMED → RESOLVED
Closed: 19 years ago
Resolution: --- → INVALID
Status: RESOLVED → VERIFIED
Severity: critical → trivial
You need to log in before you can comment on or make changes to this bug.