Closed
Bug 314489
Opened 20 years ago
Closed 20 years ago
[PostgreSQL] Buglists sorted by importance fail
Categories
(Bugzilla :: Query/Bug List, defect, P1)
Tracking
()
RESOLVED
FIXED
Bugzilla 2.20
People
(Reporter: LpSolit, Assigned: mkanat)
References
Details
Attachments
(1 file, 1 obsolete file)
503 bytes,
patch
|
LpSolit
:
review+
|
Details | Diff | Splinter Review |
In query.cgi, choose "Sort results by: Importance" using PostgreSQL (either 7 or 8). You get a SQL error:
DBD::Pg::st execute failed: ERROR: column "bug_status.sortkey" must appear in the GROUP BY clause or be used in an aggregate function [for Statement "SELECT bugs.bug_id, bugs.bug_severity, bugs.priority, bugs.bug_status, bugs.resolution, bugs.bug_severity, bugs.priority, bugs.op_sys, map_assigned_to.login_name, bugs.bug_status, bugs.resolution, bugs.short_desc FROM bugs INNER JOIN profiles AS map_assigned_to ON (bugs.assigned_to = map_assigned_to.userid) LEFT JOIN bug_status ON (bug_status.value = bugs.bug_status) LEFT JOIN priority ON (priority.value = bugs.priority) LEFT JOIN bug_group_map ON bug_group_map.bug_id = bugs.bug_id AND bug_group_map.group_id NOT IN (8,16,4,9,14,18,2,17,12,3,10,11,13,1,6,15,5,7) LEFT JOIN cc ON cc.bug_id = bugs.bug_id AND cc.who = 10195 WHERE ((bugs.bug_status IN ('REOPENED'))) AND bugs.creation_ts IS NOT NULL AND ((bug_group_map.group_id IS NULL) OR (bugs.reporter_accessible = 1 AND bugs.reporter = 10195) OR (bugs.cclist_accessible = 1 AND cc.who IS NOT NULL) OR (bugs.assigned_to = 10195) OR (bugs.qa_contact = 10195) ) GROUP BY bugs.bug_id, bugs.bug_severity, bugs.priority, bugs.bug_status, bugs.resolution, bugs.op_sys, map_assigned_to.login_name, bugs.short_desc ORDER BY bug_status.sortkey ,bug_status.value ,priority.sortkey ,priority.value ,map_assigned_to.login_name ,bugs.bug_id "] at /var/www/html/qa222pg/buglist.cgi line 883
Assignee | ||
Comment 1•20 years ago
|
||
I'll take this. I wrote the %specialjoin code and the Pg code. It should be fairly easy for me to fix. :-)
And it's affecting my personal installation, now. :-)
Assignee: query-and-buglist → mkanat
Priority: -- → P1
Target Milestone: --- → Bugzilla 2.22
Assignee | ||
Comment 2•20 years ago
|
||
OK, this fixes the bug. The problem is that some $field values had spaces around them, and that was breaking the regex. Instead of making the regex even more complicated, I'm just trimming the field.
Attachment #204002 -
Flags: review?(LpSolit)
Assignee | ||
Updated•20 years ago
|
Status: NEW → ASSIGNED
Target Milestone: Bugzilla 2.22 → Bugzilla 2.20
Version: 2.21 → 2.20
![]() |
Reporter | |
Comment 3•20 years ago
|
||
Comment on attachment 204002 [details] [diff] [review]
v1
> foreach my $field (@fields, @orderby) {
>+ # Some fields may have spaces around them which will break the regexes.
>+ $field = trim($field);
> next if ($field =~ /(AVG|SUM|COUNT|MAX|MIN|VARIANCE)\s*\(/i ||
> $field =~ /^\d+$/ || $field eq "bugs.bug_id" ||
> $field =~ /^relevance/);
The problem is that BuildOrderBy() adds fields of the form:
push(@$stringlist, $orderfield . ' ' . $orderdirection);
If $orderdirection is empty, then we have a trailing whitespace, which breaks the regexp. I think this is the place where you should trim the value added to the array, so that we don't have to worry about these fields anymore everytime we add a regexp in Search.pm.
Attachment #204002 -
Flags: review?(LpSolit) → review-
Assignee | ||
Comment 4•20 years ago
|
||
Ah yeah, I agree. Good idea. :-)
Attachment #204002 -
Attachment is obsolete: true
Attachment #204009 -
Flags: review?(LpSolit)
![]() |
Reporter | |
Comment 5•20 years ago
|
||
Comment on attachment 204009 [details] [diff] [review]
v2
r=LpSolit
Attachment #204009 -
Flags: review?(LpSolit) → review+
![]() |
Reporter | |
Updated•20 years ago
|
Flags: approval?
Flags: approval2.20?
Updated•20 years ago
|
Flags: approval?
Flags: approval2.20?
Flags: approval2.20+
Flags: approval+
Assignee | ||
Comment 6•20 years ago
|
||
tip:
Checking in Bugzilla/Search.pm;
/cvsroot/mozilla/webtools/bugzilla/Bugzilla/Search.pm,v <-- Search.pm
new revision: 1.120; previous revision: 1.119
done
2.20:
Checking in Bugzilla/Search.pm;
/cvsroot/mozilla/webtools/bugzilla/Bugzilla/Search.pm,v <-- Search.pm
new revision: 1.99.2.9; previous revision: 1.99.2.8
done
Status: ASSIGNED → RESOLVED
Closed: 20 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•