summaryrefslogtreecommitdiffstats
path: root/Bugzilla/FlagType.pm
diff options
context:
space:
mode:
authormkanat%kerio.com <>2005-03-16 09:27:14 +0100
committermkanat%kerio.com <>2005-03-16 09:27:14 +0100
commitb99cbd1d893ff0a730ab7187f409bcdf3c6f4aeb (patch)
treeb2769bdde9c44eefd7834dcbc18e67e66d6d1aa9 /Bugzilla/FlagType.pm
parent94dcd5edee079a1bb67a0011711d25a4be0f14c6 (diff)
downloadbugzilla-b99cbd1d893ff0a730ab7187f409bcdf3c6f4aeb.tar.gz
bugzilla-b99cbd1d893ff0a730ab7187f409bcdf3c6f4aeb.tar.xz
Bug 174295: ANSI SQL requires all columns in SELECT to be in GROUP BY, unless they are in "aggregate" functions
Patch By Tomas Kopal <Tomas.Kopal@altap.cz> r=joel, a=myk
Diffstat (limited to 'Bugzilla/FlagType.pm')
-rw-r--r--Bugzilla/FlagType.pm7
1 files changed, 5 insertions, 2 deletions
diff --git a/Bugzilla/FlagType.pm b/Bugzilla/FlagType.pm
index 5b681dc0c..8a6eb0272 100644
--- a/Bugzilla/FlagType.pm
+++ b/Bugzilla/FlagType.pm
@@ -120,7 +120,8 @@ sub match {
my @tables = @base_tables;
my @columns = @base_columns;
my $having = "";
-
+ my $dbh = Bugzilla->dbh;
+
# Include a count of the number of flags per type if requested.
if ($include_count) {
push(@columns, "COUNT(flags.id)");
@@ -136,7 +137,9 @@ sub match {
my $where_clause = "WHERE " . join(" AND ", @criteria);
my $query = "$select_clause $from_clause $where_clause";
- $query .= " GROUP BY flagtypes.id " if ($include_count || $having ne "");
+ $query .= " " . $dbh->sql_group_by('flagtypes.id',
+ join(', ', @base_columns[2..$#base_columns]))
+ if ($include_count || $having ne "");
$query .= " HAVING $having " if $having ne "";
$query .= " ORDER BY flagtypes.sortkey, flagtypes.name";