I am using drupal 4.5.2 and ran into a problem with the taxonomy_browser with PostgreSQL.

Based on the findings in http://drupal.org/node/11510 Postgres does not allow the columns in a SELECT DISTINCT to mistmatch the columns in the ORDER BY or GROUP BY portion of the query. The taxonomy_browser.module contains two queries that reference n.sticky and n.title in the ORDER BY clause.

I have not evaluated the entire module to create a fix, only the query in question and so am not confident in my solution. That said, as the select was returning a count, I felt that the ORDER BY clause was not required and removed it. So,

$sql_count = 'SELECT COUNT(DISTINCT(n.nid)) FROM {node} n '. node_access_join_sql() .' INNER JOIN {term_node} tn ON n.nid = tn.nid WHERE tn.tid IN ('. $str_tids .') AND n.status = 1 AND '. node_access_where_sql() . $wheres .' ORDER BY n.sticky DESC, n.title ASC';

becomes

$sql_count = 'SELECT COUNT(DISTINCT(n.nid)) FROM {node} n '. node_access_join_sql() .' INNER JOIN {term_node} tn ON n.nid = tn.nid WHERE tn.tid IN ('. $str_tids .') AND n.status = 1 AND '. node_access_where_sql();

Comments

Steve Simms’s picture

See #76819. This seems to be a core bug, rather than a taxonomy browser bug.

nancydru’s picture

Status: Active » Closed (duplicate)