Closed (fixed)
Project:
PM Lite
Version:
6.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Reporter:
Created:
22 Jun 2008 at 14:59 UTC
Updated:
27 Jan 2009 at 04:20 UTC
Within function comment_get_recent() of the comment module, the following query is issued:
$result = db_query_range(db_rewrite_sql("SELECT nc.nid FROM {node_comment_statistics} nc WHERE nc.comment_count > 0 ORDER BY nc.last_comment_timestamp DESC", 'nc'), 0, $number);
Through pm_lite_db_rewrite_sql(), PM Lite adds "n.type != 'pm'" to the query, but there is no field "type" in the node_comment_statistics table.
I fixed this (temporarily?) by adding if ($primary_field == 'nid' && $primary_table != 'nc') to the pm_lite_db_rewrite_sql() function, but that's probably just a temporary hack.
Thanks.
Comments
Comment #1
rszrama commentedAwesome, thanks for the report. I'll make your temporary change and revisit it when I decide if that whole method of rewriting SQL is even feasible.
Comment #2
mjourney2 commentedI think the conflict comes from the n. prefix. So
removing the n. might do the tricksince I think only one table has a field called "type" and therefore the table prefix may not be needed. Seems to be solving the views problem.======
Scratch that ... The search index table has a "type" column. Conflicts are created there if the prefix is removed. Instead, I added the $primary_table variable as prefix on line 160, which seems to be working:
return array('where' => "$primary_table.type != 'pm'");
Comment #3
rszrama commentedOk... I'm working on debugging this fix in conjunction w/ http://drupal.org/project/issue/265158. It seems this would still make the module incompatible with Views unless I worked in some specific exception, eh?
Comment #4
rszrama commentedAlrighty, just committed a fix that combines the above two suggestions. We'll see what happens next! : P