? 291079_query.inc_group_by.patch
? 291292_count_distinct_field_props.patch
? views2_pgsql_291079_full.patch
? views2_pgsql_group_by_fix.patch
Index: includes/argument.handlers.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/views/includes/argument.handlers.inc,v
retrieving revision 1.39
diff -u -r1.39 argument.handlers.inc
--- includes/argument.handlers.inc	25 Jun 2008 22:20:01 -0000	1.39
+++ includes/argument.handlers.inc	5 Aug 2008 08:21:23 -0000
@@ -534,12 +534,10 @@
   function summary_basics($count_field = TRUE) {
     // Add the number of nodes counter
     $field = $this->query->base_table . '.' . $this->query->base_field;
-    if ($this->view->display_handler->get_option('distinct') && empty($this->query->no_distinct)) {
-      $field = "DISTINCT($field)";
-    }
-
-    $count_alias = $this->query->add_field(NULL, "COUNT($field)", 'num_records');
-    $this->query->add_groupby($this->name_alias);
+    $distinct = ($this->view->display_handler->get_option('distinct') && empty($this->query->no_distinct));
+    
+    $count_alias = $this->query->add_field(NULL, $field, 'num_records',
+                                           array('count' => TRUE, 'distinct' => $distinct));
 
     if ($count_field) {
       $this->query->set_count_field($this->table_alias, $this->real_field);
Index: includes/query.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/views/includes/query.inc,v
retrieving revision 1.21
diff -u -r1.21 query.inc
--- includes/query.inc	23 Jun 2008 23:49:40 -0000	1.21
+++ includes/query.inc	5 Aug 2008 08:21:24 -0000
@@ -568,7 +568,7 @@
    * @return $name
    *   The name that this field can be referred to as. Usually this is the alias.
    */
-  function add_field($table, $field, $alias = '') {
+  function add_field($table, $field, $alias = '', $params = NULL) {
     // We check for this specifically because it gets a special alias.
     if ($table == $this->base_table && $field == $this->base_field && empty($alias)) {
       $alias = $this->base_field;
@@ -591,6 +591,11 @@
         'alias' => $alias,
       );
     }
+    
+    foreach ((array)$params as $key => $value) {
+      $this->fields[$name][$key] = $value;
+    }
+    
     return $name;
   }
 
