Commit cc785b8e authored by mkanat%kerio.com's avatar mkanat%kerio.com

Bug 174295: ANSI SQL requires all columns in SELECT to be in GROUP BY, unless…

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
parent 8ef31d2a
......@@ -352,7 +352,10 @@ sub can_see_bug {
ON bugs.bug_id = bug_group_map.bug_id
AND bug_group_map.group_ID NOT IN(" .
join(',',(-1, values(%{$self->groups}))) .
") WHERE bugs.bug_id = ? GROUP BY bugs.bug_id");
") WHERE bugs.bug_id = ? " .
$dbh->sql_group_by('bugs.bug_id', 'reporter, ' .
'assigned_to, qa_contact, reporter_accessible, ' .
'cclist_accessible'));
}
$sth->execute($bugid);
my ($reporter, $owner, $qacontact, $reporter_access, $cclist_access,
......@@ -948,6 +951,7 @@ sub get_userlist {
return $self->{'userlist'} if defined $self->{'userlist'};
my $dbh = Bugzilla->dbh;
my $query = "SELECT DISTINCT login_name, realname,";
if (&::Param('usevisibilitygroups')) {
$query .= " COUNT(group_id) ";
......@@ -962,9 +966,9 @@ sub get_userlist {
join(', ', (-1, @{$self->visible_groups_inherited})) . ") " .
"AND grant_type <> " . GRANT_DERIVED;
}
$query .= " WHERE disabledtext = '' GROUP BY userid";
$query .= " WHERE disabledtext = '' ";
$query .= $dbh->sql_group_by('userid', 'login_name, realname');
my $dbh = Bugzilla->dbh;
my $sth = $dbh->prepare($query);
$sth->execute;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment