Closed
Bug 298400
Opened 20 years ago
Closed 19 years ago
[PostgreSQL] SQL error using buglist.cgi and full text search. Column "relevance desc" not valid in GROUP BY
Categories
(Bugzilla :: Query/Bug List, defect)
Tracking
()
RESOLVED
FIXED
Bugzilla 2.20
People
(Reporter: dkl, Assigned: mkanat)
References
Details
Attachments
(1 file)
|
756 bytes,
patch
|
Wurblzap
:
review+
bugreport
:
review+
|
Details | Diff | Splinter Review |
When using search-specific.html.tmpl (fulltext), the order by is set to "relevance
desc". This gets added to the ORDER BY clause of the SQL statement properly, but
it also gets added to the field list in the GROUP BY clause which causes an SQL
error.
foreach my $field (@fields, @orderby) {
next if ($field =~ /(AVG|SUM|COUNT|MAX|MIN|VARIANCE)\s*\(/i ||
- $field =~ /^\d+$/ || $field eq "bugs.bug_id");
+ $field =~ /^\d+$/ || $field eq "bugs.bug_id" || $field eq
"relevance desc");
if ($field =~ /.*AS\s+(\w+)$/i) {
push(@groupby, $1) if !grep($_ eq $1, @groupby);
} else {
The diff above in Bugzilla/Search.pm fixes the problem but I am not sure if it
is the most elegant way to do it.| Assignee | ||
Comment 1•19 years ago
|
||
Hrm... I might just have to hack in a fix for that manually. I'll see if I can't come up with something better, though.
OS: Linux → All
Hardware: PC → All
Summary: SQL error using buglist.cgi and full text search on PostgreSQL. Column "relevance desc" not valid in GROUP BY → [PostgreSQL] SQL error using buglist.cgi and full text search. Column "relevance desc" not valid in GROUP BY
| Assignee | ||
Updated•19 years ago
|
Target Milestone: --- → Bugzilla 2.20
| Assignee | ||
Comment 2•19 years ago
|
||
Ohhhh... the problem is that it's using "desc" in the GROUP BY. I think that's all we need to fix. :-)
| Assignee | ||
Updated•19 years ago
|
Assignee: query-and-buglist → mkanat
| Assignee | ||
Updated•19 years ago
|
Status: NEW → ASSIGNED
| Assignee | ||
Comment 3•19 years ago
|
||
Yeah, I basically used your solution. At first, I tried just removing the DESC with a regex, but then Pg also complained that aggregates aren't allowed in the GROUP BY clause. :-) So instead I'm just removing relevance entirely.
Attachment #189279 -
Flags: review?(dkl)
| Assignee | ||
Comment 4•19 years ago
|
||
*** Bug 300865 has been marked as a duplicate of this bug. ***
| Assignee | ||
Comment 5•19 years ago
|
||
Comment on attachment 189279 [details] [diff] [review] Exclude relevance from GROUP BY This is really brief; one changed line, if you have a second to review it, LpSolit.
Attachment #189279 -
Flags: review?(dkl) → review?(LpSolit)
Comment 6•19 years ago
|
||
Comment on attachment 189279 [details] [diff] [review] Exclude relevance from GROUP BY I prefer joel to look at this patch. A one-liner doesn't mean it has no side-effect. And I'm not familiar enough with the code in Search.pm to guarantee it has none.
Attachment #189279 -
Flags: review?(LpSolit) → review?(bugreport)
| Assignee | ||
Comment 7•19 years ago
|
||
Comment on attachment 189279 [details] [diff] [review] Exclude relevance from GROUP BY I'm not sure joel has the time to do reviews, nowadays, but perhaps glob does? :-)
Attachment #189279 -
Flags: review?(bugreport) → review?(bugzilla)
| Assignee | ||
Updated•19 years ago
|
Attachment #189279 -
Flags: review?(bugzilla) → review?(wurblzap)
Comment 8•19 years ago
|
||
Comment on attachment 189279 [details] [diff] [review] Exclude relevance from GROUP BY I can't reproduce finding relevance in GROUP BY, but it looks sensible to me, and it doesn't seem to break anything. Asking for a second review.
Attachment #189279 -
Flags: review?(wurblzap)
Attachment #189279 -
Flags: review?
Attachment #189279 -
Flags: review+
Comment 9•19 years ago
|
||
Comment on attachment 189279 [details] [diff] [review] Exclude relevance from GROUP BY r=joel by inspection.
Attachment #189279 -
Flags: review? → review+
Comment 10•19 years ago
|
||
the patch applies cleanly to both 2.20 and tip. Requesting approval.
Flags: approval?
Flags: approval2.20?
Comment 11•19 years ago
|
||
Agreed. ANSI SQL spec says GROUP BY only needs to include real columns, not aggregates (and Postgres is enforcing that). This is the right thing to do.
Flags: approval?
Flags: approval2.20?
Flags: approval2.20+
Flags: approval+
Updated•19 years ago
|
Whiteboard: [patch awaiting checkin]
| Assignee | ||
Comment 12•19 years ago
|
||
Tip: Checking in Bugzilla/Search.pm; /cvsroot/mozilla/webtools/bugzilla/Bugzilla/Search.pm,v <-- Search.pm new revision: 1.108; previous revision: 1.107 done 2.20: Checking in Bugzilla/Search.pm; /cvsroot/mozilla/webtools/bugzilla/Bugzilla/Search.pm,v <-- Search.pm new revision: 1.99.2.4; previous revision: 1.99.2.3 done
Status: ASSIGNED → RESOLVED
Closed: 19 years ago
Resolution: --- → FIXED
Updated•19 years ago
|
Whiteboard: [patch awaiting checkin]
Comment 13•19 years ago
|
||
*** Bug 306348 has been marked as a duplicate of this bug. ***
Comment 14•19 years ago
|
||
*** Bug 315495 has been marked as a duplicate of this bug. ***
Comment 15•19 years ago
|
||
*** Bug 315495 has been marked as a duplicate of this bug. ***
You need to log in
before you can comment on or make changes to this bug.
Description
•