jenkins-bot has submitted this change and it was merged.

Change subject: PostgreSQL: Fix Special:ActiveUsers GROUP BY query
......................................................................


PostgreSQL: Fix Special:ActiveUsers GROUP BY query

For GROUP BY queries, PostgreSQL require all columns in the
unaggregated part of the select list to also be in the
GROUP BY list.

To fix this, add user_name and user_id to the GROUP BY list along side
qcc_title.

This addition cannot change the query results, because user_name and
user_id are functionally dependent on qcc_title: user_name because
of the WHERE clause for this query, and user_id due to the 1 to 1
relationship between user_name and user_id enforced by their unique
and not null constraints on the underlying table.

This has been tested on PostgreSQL and MySQL.

Bug: 68087
Change-Id: I3aed715b40ff6e2290220122acbda0f0e74b5b36
(cherry picked from commit 52328f043c3f3e9a0ce76a8eadb7975bc957846e)
---
M RELEASE-NOTES-1.23
M includes/specials/SpecialActiveusers.php
2 files changed, 16 insertions(+), 1 deletion(-)

Approvals:
  Legoktm: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/RELEASE-NOTES-1.23 b/RELEASE-NOTES-1.23
index 7e4388e..1178c5b 100644
--- a/RELEASE-NOTES-1.23
+++ b/RELEASE-NOTES-1.23
@@ -1,6 +1,15 @@
 Security reminder: MediaWiki does not require PHP's register_globals. If you
 have it on, turn it '''off''' if you can.
 
+== MediaWiki 1.23.9 ==
+
+This is a (security and?) maintenance release of the MediaWiki 1.23 branch.
+
+== Changes since 1.23.8 ==
+
+* (bug T70087) Fix Special:ActiveUsers page for installations using 
+  PostgreSQL.
+
 == MediaWiki 1.23.8 ==
 
 This is a security and maintenance release of the MediaWiki 1.23 branch.
diff --git a/includes/specials/SpecialActiveusers.php 
b/includes/specials/SpecialActiveusers.php
index f739d3b..f6483cb 100644
--- a/includes/specials/SpecialActiveusers.php
+++ b/includes/specials/SpecialActiveusers.php
@@ -109,10 +109,16 @@
                        ) . ')';
                }
 
+               if ( $dbr->implicitGroupby() ) {
+                       $options = array( 'GROUP BY' => array( 'qcc_title' ) );
+               } else {
+                       $options = array( 'GROUP BY' => array( 'user_name', 
'user_id', 'qcc_title' ) );
+               }
+
                return array(
                        'tables' => array( 'querycachetwo', 'user', 
'recentchanges' ),
                        'fields' => array( 'user_name', 'user_id', 
'recentedits' => 'COUNT(*)', 'qcc_title' ),
-                       'options' => array( 'GROUP BY' => array( 'qcc_title' ) 
),
+                       'options' => $options,
                        'conds' => $conds
                );
        }

-- 
To view, visit https://gerrit.wikimedia.org/r/183898
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I3aed715b40ff6e2290220122acbda0f0e74b5b36
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/core
Gerrit-Branch: REL1_23
Gerrit-Owner: Jjanes <[email protected]>
Gerrit-Reviewer: Legoktm <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to