? files ? misc/mc_blocks.js ? sites/localhost ? sites/localhost.drupal.dotest ? sites/localhost.drupal.project ? sites/all/modules Index: includes/database.pgsql.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/database.pgsql.inc,v retrieving revision 1.43.2.1 diff -u -F^f -r1.43.2.1 database.pgsql.inc --- includes/database.pgsql.inc 19 Oct 2007 21:49:26 -0000 1.43.2.1 +++ includes/database.pgsql.inc 10 Nov 2007 16:45:22 -0000 @@ -418,7 +418,9 @@ function db_check_setup() { * @return SQL query with the DISTINCT wrapper surrounding the given table.field. */ function db_distinct_field($table, $field, $query) { - $field_to_select = 'DISTINCT ON ('. $table .'.'. $field .") $table.$field"; + // omit ON (table.field) for select count() + $field_to_select = 'DISTINCT ' . (eregi('count(\s)*\((\s)*'. $table .'.'. $field .'(\s)*\)', $query) ? '' : ' ON ('. $table .'.'. $field .')') . " $table.$field"; + // (?