Closed Bug 293015 Opened 19 years ago Closed 19 years ago

PostgreSQL: GROUP BY error when searching for bugs

Categories

(Bugzilla :: Query/Bug List, defect, P1)

2.19.2

Tracking

()

RESOLVED FIXED
Bugzilla 2.20

People

(Reporter: osirven, Assigned: osirven)

References

Details

Attachments

(1 file, 1 obsolete file)

User-Agent:       Mozilla/5.0 (X11; U; Linux i686; fr; rv:1.7.6) Gecko/20050405 Firefox/1.0 (Ubuntu package 1.0.2)
Build Identifier: Mozilla/5.0 (X11; U; Linux i686; fr; rv:1.7.6) Gecko/20050405 Firefox/1.0 (Ubuntu package 1.0.2)

When using bugzilla cvs version with a postgreSQL database, executing a saved
query will fail because of a group by error

Reproducible: Always

Steps to Reproduce:
1. Just save any query
2. Execute this saved query
Actual Results:  
Software 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.rep_platform, 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) AND (bugs.assigned_to =
map_assigned_to.userid) INNER JOIN profiles AS map_reporter ON (bugs.reporter =
map_reporter.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 (3,7,12,10,5,1,8,11,4,2,6,9)  LEFT JOIN cc ON
cc.bug_id = bugs.bug_id AND cc.who = 1 WHERE ((bugs.bug_status IN
('NEW','ASSIGNED','REOPENED')) AND ((map_assigned_to.login_name IN
('olivier@everyfeed.com')) OR (map_reporter.login_name IN
('olivier@everyfeed.com')))) AND ((bug_group_map.group_id IS NULL)    OR
(bugs.reporter_accessible = 1 AND bugs.reporter = 1)     OR
(bugs.cclist_accessible = 1 AND cc.who IS NOT NULL)     OR (bugs.assigned_to =
1) ) GROUP BY bugs.bug_id, bugs.bug_severity, bugs.priority, bugs.bug_status,
bugs.resolution, bugs.rep_platform, 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
/home/httpd/htdocs/bugzilla/buglist.cgi line 820
Attached patch A correction to this bug report (obsolete) — Splinter Review
The purpose of this patch is to add to the group by clause any field being used
in the order by clause and which is not already in the group by clause.
Blocks: bz-postgres
I thought that either we fixed this or there was another bug we had for it, but
if I can't find that I'll confirm this bug and review the patch.
Summary: group by error when searching for bugs → PostgreSQL: GROUP BY error when searching for bugs
Version: unspecified → 2.19.2
(In reply to comment #2)
> I thought that either we fixed this

My cvs version is up to date so if it is already fixed, it has not been commited yet
Version: 2.19.2 → unspecified
*Please* don't change the version field to unspecified. In our case, 2.19.2
means "2.19.2 and the tip after 2.19.2."
Version: unspecified → 2.19.2
it must be a bug with my browser because i did not change anything about the
version stuff. When I added my last comment, bugzilla crash with an error
telling me I have to retry because of a bug with mozilla navigator so I guess it
must come from this
*** Bug 292866 has been marked as a duplicate of this bug. ***
Comment on attachment 182676 [details] [diff] [review]
A correction to this bug report

We could do this even more simply and reliably, by adding the @orderby array to
the foreach above.
Attachment #182676 - Flags: review-
Assignee: query-and-buglist → osirven
Priority: -- → P1
Target Milestone: --- → Bugzilla 2.20
Olivier, would you like to produce a new version of the patch, or would you like
me to do it?
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
A new version of the patch merging the two foreach statements into one
Attachment #182676 - Attachment is obsolete: true
(In reply to comment #8)
> Olivier, would you like to produce a new version of the patch, or would you like
> me to do it?

It's done ;)
Review it and tell me if it is what you wanted.
Comment on attachment 182949 [details] [diff] [review]
new version of the patch

Yes, that's exactly what I wanted! Great! :-)

In the future, make sure to set the review flag to ? with my username, so that
I actually get a review request for the patch. :-)
Attachment #182949 - Flags: review+
Flags: approval?
(In reply to comment #11)
> In the future, make sure to set the review flag to ? with my username, so that
> I actually get a review request for the patch. :-)

Woups sorry fo that ;)

Good polish fix.  Approved for checkin during 2.20 freeze.
Flags: approval? → approval+
Checking in Bugzilla/Search.pm;
/cvsroot/mozilla/webtools/bugzilla/Bugzilla/Search.pm,v  <--  Search.pm
new revision: 1.96; previous revision: 1.95
done
Status: ASSIGNED → RESOLVED
Closed: 19 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: