From 6be8a67156704cae390997d59ec5b0eb32af43a0 Mon Sep 17 00:00:00 2001 From: "lpsolit%gmail.com" Date: Thu, 6 Oct 2005 20:42:41 +0000 Subject: [PATCH] =?UTF-8?q?Bug=20302785:=20[PostgreSQL]=20Bugzilla=20canno?= =?UTF-8?q?t=20order=20a=20buglist=20by=20number=20of=20votes=20-=20Patch?= =?UTF-8?q?=20by=20Fr=C3=A9d=C3=A9ric=20Buclin=20=20r?= =?UTF-8?q?=3Djoel=20a=3Djustdave?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: svn://10.0.0.236/trunk@181725 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/webtools/bugzilla/Bugzilla/Search.pm | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/mozilla/webtools/bugzilla/Bugzilla/Search.pm b/mozilla/webtools/bugzilla/Bugzilla/Search.pm index fc66d7f2413..5a651a3b519 100644 --- a/mozilla/webtools/bugzilla/Bugzilla/Search.pm +++ b/mozilla/webtools/bugzilla/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));