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

rszrama’s picture

Assigned: Unassigned » rszrama
Status: Active » Needs review

Awesome, 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.

mjourney2’s picture

I think the conflict comes from the n. prefix. So removing the n. might do the trick since 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'");

rszrama’s picture

Ok... 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?

rszrama’s picture

Status: Needs review » Fixed

Alrighty, just committed a fix that combines the above two suggestions. We'll see what happens next! : P

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.