Merge "PostgreSQL: Fix Special:ActiveUsers GROUP BY query"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Wed, 7 Jan 2015 20:33:40 +0000 (20:33 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Wed, 7 Jan 2015 20:33:40 +0000 (20:33 +0000)
includes/specials/SpecialActiveusers.php

index ff63243..0caf6b4 100644 (file)
@@ -115,10 +115,16 @@ class ActiveUsersPager extends UsersPager {
                        ) . ')';
                }
 
+               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
                );
        }