Accessing project/issues/statistics generates a SQL warning. Average lifetime and issue activity populate correctly, but the Project overview table at the bottom does not.

Drupal 5.7, Project 5.x-1.1, Project Issue 5.x-2.0, PHP 5.2.3, MySQL 5.0.45

user warning: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'DISTINCT(n.nid), pn.title, COUNT(n.nid) AS total FROM node n INNER JOIN project_' at line 1 query: SELECT p DISTINCT(n.nid), pn.title, COUNT(n.nid) AS total FROM node n INNER JOIN project_issues p ON n.nid = p.nid INNER JOIN node pn ON p.pid = pn.nid WHERE n.status = 1 AND pn.status = 1 AND p.sid = 1 GROUP BY pn.nid, pn.title ORDER BY total DESC LIMIT 0, 15 in /webdocs/includes/database.mysql.inc on line 172.

I took a look at the pager_query defined in line 394 of issue.inc. It looks like db_rewrite_sql is changing "SELECT pn.nid" to "SELECT p DISTINCT(n.nid)" which was causing the error. I tried changing "pn" to "x" everywhere in that line and the error went away.

Patch attached.

CommentFileSizeAuthor
project_issue-pager_query.patch1.42 KBmicahw156

Comments

dww’s picture

Status: Needs review » Closed (duplicate)

http://drupal.org/node/172035

I'm not sure that patch is a viable solution, there's probably a cleaner way to solve this. But, feel free to reply to the other issue with a link to http://drupal.org/files/issues/project_issue-pager_query.patch if you want folks to consider it.

Thanks,
-Derek