summaryrefslogtreecommitdiffstats
path: root/Bugzilla
diff options
context:
space:
mode:
authorlpsolit%gmail.com <>2005-10-07 05:42:41 +0200
committerlpsolit%gmail.com <>2005-10-07 05:42:41 +0200
commit3c457877d82dd27ab2090e04e12c4a10031f3bf0 (patch)
treed5769cf8b9a62c26c8e3cf392e4935a8d4d1cf4f /Bugzilla
parent73895d59f694c2f0b927d77f0a9ca65385139969 (diff)
downloadbugzilla-3c457877d82dd27ab2090e04e12c4a10031f3bf0.tar.gz
bugzilla-3c457877d82dd27ab2090e04e12c4a10031f3bf0.tar.xz
Bug 302785: [PostgreSQL] Bugzilla cannot order a buglist by number of votes - Patch by Frédéric Buclin <LpSolit@gmail.com> r=joel a=justdave
Diffstat (limited to 'Bugzilla')
-rw-r--r--Bugzilla/Search.pm7
1 files changed, 4 insertions, 3 deletions
diff --git a/Bugzilla/Search.pm b/Bugzilla/Search.pm
index fc66d7f24..5a651a3b5 100644
--- a/Bugzilla/Search.pm
+++ b/Bugzilla/Search.pm
@@ -1418,10 +1418,11 @@ sub init {
next if ($field =~ /(AVG|SUM|COUNT|MAX|MIN|VARIANCE)\s*\(/i ||
$field =~ /^\d+$/ || $field eq "bugs.bug_id" ||
$field =~ /^relevance/);
- if ($field =~ /.*AS\s+(\w+)$/i) {
+ # The structure of fields is of the form:
+ # [foo AS] {bar | bar.baz} [ASC | DESC]
+ # Only the mandatory part bar OR bar.baz is of interest
+ if ($field =~ /(?:.*\s+AS\s+)?(\w+(\.\w+)?)(?:\s+(ASC|DESC))?$/i) {
push(@groupby, $1) if !grep($_ eq $1, @groupby);
- } else {
- push(@groupby, $field) if !grep($_ eq $field, @groupby);
}
}
$query .= ") " . $dbh->sql_group_by("bugs.bug_id", join(', ', @groupby));