From be3ed9c27c69b2d8f90d9ab7d59f5bafd83425bc Mon Sep 17 00:00:00 2001 From: "lpsolit%gmail.com" <> Date: Fri, 7 Oct 2005 03:48:08 +0000 Subject: [PATCH] =?utf8?q?Bug=20302785:=20[PostgreSQL]=20Bugzilla=20cannot?= =?utf8?q?=20order=20a=20buglist=20by=20number=20of=20votes=20-=20Patch=20?= =?utf8?q?by=20Fr=C3=A9d=C3=A9ric=20Buclin=20=20r=3Djoe?= =?utf8?q?l=20a=3Djustdave?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- Bugzilla/Search.pm | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Bugzilla/Search.pm b/Bugzilla/Search.pm index 56d2846f37..0e9a56b0f5 100644 --- a/Bugzilla/Search.pm +++ b/Bugzilla/Search.pm @@ -1380,10 +1380,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)); -- 2.47.2