SelectQuery::countQuery() should also remove all_fields statements.

From: damz <damz@damz-dev.local>


---
 database/select.inc |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)

diff --git includes/database/select.inc includes/database/select.inc
index 11c3813..448bebf 100644
--- includes/database/select.inc
+++ includes/database/select.inc
@@ -568,6 +568,12 @@ class SelectQueryExtender implements SelectQueryInterface {
     $expressions =& $count->getExpressions();
     $expressions = array();
 
+    // Also remove 'all_fields' statements, which will be expanded when
+    // the query will be executed.
+    foreach ($count->tables as $alias => &$table) {
+      unset($table['all_fields']);
+    }
+
     // Ordering a count query is a waste of cycles, and breaks on some
     // databases anyway.
     $orders = &$count->getOrderBy();
@@ -1030,6 +1036,12 @@ class SelectQuery extends Query implements SelectQueryInterface {
     $expressions =& $count->getExpressions();
     $expressions = array();
 
+    // Also remove 'all_fields' statements, which will be expanded when
+    // the query will be executed.
+    foreach ($count->tables as $alias => &$table) {
+      unset($table['all_fields']);
+    }
+
     // Ordering a count query is a waste of cycles, and breaks on some
     // databases anyway.
     $orders = &$count->getOrderBy();
