Hi!
I use drupal 5.2, PostgreSQL 8.2.1, Views 5.x-1.6.
I try to make a page view and I get those warnings:

* warning: pg_query(): Query failed: ERROR: syntax error at or near "ON" LINE 1: SELECT count( DISTINCT ON (node.nid) node.nid) FROM node nod... ^ in /var/www/html/drupal-5.2/includes/database.pgsql.inc on line 125.
* user warning: query: SELECT count( DISTINCT ON (node.nid) node.nid) FROM node node LEFT JOIN term_node term_node ON node.nid = term_node.nid LEFT JOIN term_hierarchy term_hierarchy ON term_node.tid = term_hierarchy.tid INNER JOIN node_access na ON na.nid = node.nid WHERE (na.grant_view >= 1 AND ((na.gid = 0 AND na.realm = 'all') OR (na.gid = 1 AND na.realm = 'term_access'))) AND ( (term_node.tid = '5') ) in /var/www/html/drupal-5.2/includes/database.pgsql.inc on line 144.

The sql should be in order to work in postgres:

SELECT count( DISTINCT (node.nid) ) FROM ...

But I don't know where to modify, becose I don't find this sql.

I don't get those warnings for a block view, only for page view.

Can u tell me where should I modify to corect the sql?

Thank u in advance!

Comments

merlinofchaos’s picture

Status: Active » Closed (won't fix)

The DISTINCT ON is getting added by some hook_db_rewrite_sql() -- probably core's -- and it's a bug in Drupal. There's nothing that can be done about it in Views.