? faceted_search.inc.pgsql.200902242210.patch Index: faceted_search.inc =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/faceted_search/faceted_search.inc,v retrieving revision 1.57 diff -u -r1.57 faceted_search.inc --- faceted_search.inc 4 Jan 2009 19:36:25 -0000 1.57 +++ faceted_search.inc 24 Feb 2009 11:11:23 -0000 @@ -1171,7 +1171,9 @@ // improvement. // // See http://drupal.org/node/109513 regarding the use of HEAP engine. - db_query('CREATE TEMPORARY TABLE '. $this->_results_table .' (nid int unsigned NOT NULL, PRIMARY KEY (nid)) Engine=HEAP '. $query->query(), $query->args(), $this->_results_table); + $querystr = str_replace('FROM', "INTO TEMPORARY TABLE $this->_results_table FROM", $query->query()); + //db_query('CREATE TEMPORARY TABLE '. $this->_results_table . str_replace($query->query(), 'SELECT', ''), $query->args(), $this->_results_table); + db_query($querystr, $query->args(), $this->_results_table); $this->_results_count = db_result(db_query('SELECT COUNT(*) FROM '. $this->_results_table)); $this->_ready = TRUE; } @@ -1272,12 +1274,13 @@ $query->add_where("n.type IN ('". implode("','", $types) ."')"); } + $querystr = str_replace('BY node_type_type', 'BY node_type.type, node_type.name', $query->query()); // Run the query and return the categories. if (isset($from) && isset($max_count)) { - $results = db_query_range($query->query(), $query->args(), $from, $max_count); + $results = db_query_range($querystr, $query->args(), $from, $max_count); } else { - $results = db_query($query->query(), $query->args()); + $results = db_query($querystr, $query->args()); } return $facet->build_categories($results); } @@ -1615,7 +1618,7 @@ * Either 'ASC' or 'DESC'. */ function add_groupby($clause, $order = 'ASC') { - $this->groupby[$this->current_part][] = $clause .' '. $order; + $this->groupby[$this->current_part][] = $clause;// .' '. $order; } /**