Closed Bug 150882 Opened 21 years ago Closed 21 years ago

SQL error when sorting by bugs.votes with explicit direction

Categories

(Bugzilla :: Query/Bug List, defect)

x86
Linux
defect
Not set
normal

Tracking

()

RESOLVED FIXED
Bugzilla 2.16

People

(Reporter: darkshadow, Assigned: bbaetz)

References

()

Details

(Keywords: regression)

Attachments

(1 file)

go to:
http://bugzilla.mozilla.org/buglist.cgi?bug_status=UNCONFIRMED&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&bug_status=RESOLVED&email1=&emailtype1=substring&emailassigned_to1=1&email2=&emailtype2=substring&emailreporter2=1&bugidtype=include&bug_id=&changedin=1&votes=&chfield=%5BBug+creation%5D&chfieldfrom=&chfieldto=Now&chfieldvalue=&product=Browser&product=MailNews&short_desc=&short_desc_type=substring&long_desc=&long_desc_type=substring&bug_file_loc=&bug_file_loc_type=substring&status_whiteboard=&status_whiteboard_type=substring&keywords=&keywords_type=anywords&field0-0-0=noop&type0-0-0=noop&value0-0-0=&cmdtype=doit&newqueryname=&order=Reuse+same+sort+as+last+time
("View Bugs Already Reported Today")
or http://bugzilla.mozilla.org/query.cgi
and submit a query. here is what you'll see (taken from the first example):

-------------
Please stand by ...
Content-type: text/html
Software error:
SELECT DISTINCT bugs.bug_id, bugs.groupset, bugs.bug_severity, bugs.priority,
bugs.rep_platform, map_assigned_to.login_name, bugs.bug_status, bugs.resolution,
bugs.short_desc FROM bugs, profiles map_assigned_to, profiles map_reporter LEFT
JOIN profiles map_qa_contact ON bugs.qa_contact = map_qa_contact.userid LEFT
JOIN cc selectVisible_cc ON bugs.bug_id = selectVisible_cc.bug_id AND
selectVisible_cc.who = 22572 WHERE ((bugs.groupset & 0) = bugs.groupset OR
(bugs.reporter_accessible = 1 AND bugs.reporter = 22572) OR
(bugs.cclist_accessible = 1 AND selectVisible_cc.who = 22572 AND not
isnull(selectVisible_cc.who))) AND bugs.assigned_to = map_assigned_to.userid AND
bugs.reporter = map_reporter.userid AND (bugs.product = 'Browser' OR
bugs.product = 'MailNews') AND (bugs.bug_status = 'UNCONFIRMED' OR
bugs.bug_status = 'NEW' OR bugs.bug_status = 'ASSIGNED' OR bugs.bug_status =
'REOPENED' OR bugs.bug_status = 'RESOLVED') AND ((to_days(now()) -
to_days(bugs.delta_ts)) < '2') AND (bugs.creation_ts > '2002-06-11 00:00:00')
ORDER BY bugs.votes desc desc, bugs.priority, bugs.bug_severity : You have an
error in your SQL syntax near 'desc, bugs.priority, bugs.bug_severity ' at line
4 at globals.pl line 276.

For help, please send mail to the webmaster (webmaster@mozilla.org), giving this
error message and the time and date of the error. 
-------------

I suppose this is the 1000th report of this bug, but I can't search for it....
I just tried the link, and it worked for me.  Were you logged in when it
happened?  What happens if you log out/in (whatever is the opposite of how you
were before) and then try it?
It happens always, it seems not to depend on if I'm logged in or out. It also
shoudn't, if the "You have an error in your SQL syntax near 'desc,
bugs.priority, bugs.bug_severity ' at line 4 at globals.pl line 276"-part of the
error message is right ;)
What browser are you using?
i'm seeing the same thing, whether logged out or logged in. using 2002061108 on
win2000. happens with any query.
works now.  I opened the URL in IE and it worked ok.  couldn't imagine why that
should be, i then went back to mozilla and deleted all the cookies set by
bugzilla.mozilla.org.  tried the query URL again and it worked.  I guess my (and
Sven's) old bugzilla cookies are confusing the new bugzilla somehow?

Sven - try going into the cookie manager and deleting the cookies set by
bugzilla.mozilla.org, and then see if that fixes it for you too.
'bugs.votes desc' in the order param is coverted to 'bugs.votes desc desc' which
obviously fails

    # If we are sorting by votes, sort in descending order.
    if ($db_order =~ /bugs.votes\s*(asc|desc){0}/i) {
        $db_order =~ s/bugs.votes/bugs.votes desc/i;
    }

isn't doing what you expected it to do. That regexp looks odd to me, though.

Patch coming

2.14 had the desc in the votes DefCol, which is probably why it wasn't affected
Assignee: endico → bbaetz
Keywords: regression
Target Milestone: --- → Bugzilla 2.16
Attached patch patchSplinter Review
Status: NEW → ASSIGNED
Keywords: patch, review
Summary: Query not working → SQL error when sorting by bug.votes with explicit direction
I deleted all cookies from bugzilla.mozilla.org, but the problem remains :-(
I use Mozilla 1.1 trunk 2002060208 on Linux, it doesn't happen on a 10 hours old
self compiled cvs trunk and a new profile.
try the link:

http://bugzilla.mozilla.org/buglist.cgi?order=bugs.bug_id&bug_id=150882

That should reset the order cookie.

Or you could just specifiy a sort order on the query screen.
Comment on attachment 87310 [details] [diff] [review]
patch

2xr=gerv.

Gerv
Attachment #87310 - Flags: review+
Checked in, trunk + branch:

Checking in buglist.cgi;
/cvsroot/mozilla/webtools/bugzilla/buglist.cgi,v  <--  buglist.cgi
new revision: 1.175; previous revision: 1.174
done

Checking in buglist.cgi;
/cvsroot/mozilla/webtools/bugzilla/buglist.cgi,v  <--  buglist.cgi
new revision: 1.169.2.7; previous revision: 1.169.2.6
done
Status: ASSIGNED → RESOLVED
Closed: 21 years ago
Resolution: --- → FIXED
Summary: SQL error when sorting by bug.votes with explicit direction → SQL error when sorting by bugs.votes with explicit direction
Whiteboard: [applied to b.m.o]
Whiteboard: [applied to b.m.o]
QA Contact: matty_is_a_geek → default-qa
You need to log in before you can comment on or make changes to this bug.