user warning: Unknown column 'n.type' in 'where clause' query: SELECT nc.nid FROM node_comment_statistics nc LEFT JOIN drigg_node dn2 ON dn2.dnid = n.nid WHERE ( 1=1 AND !(n.type='drigg' AND dn2.killed=1 ) ) AND ( nc.comment_count > 0 ) ORDER BY nc.last_comment_timestamp DESC LIMIT 0, 10 in /var/www/dailyradical.org/htdocs/includes/database.mysqli.inc on line 151.
Comments
Comment #1
rek2 commentedComment #2
mercmobily commentedHi,
This is a bug, and it needs to get fixed.
Can you please let me know exactly how to reproduce it?
It's possibly because of my poor skills in using hook_db_rewrite_sql (which I use to "hide" killed nodes).
I did some initial research. My rewrite only happens when the primary field is "n" (node) (see drigg.module, line 97):
if($primary_table='n' && $primary_field == 'nid'){
The only query I could find in Drupal that matches your warning is on line 252 of comment.module:
$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);
[10 minutes later]
AAAAAAAAAHHHHHHHHHHHHHHHHHHHHHH!!!!!!!!!
Found the bug. I can't believe I had missed it. I just can't.
if($primary_table='n' && $primary_field == 'nid'){
That "=" needs to be == !!!!!!!
This is funny. This is the sort of mistakes a 1st year CS student would make...
My apologies everybody. Fixed in the latest drigg distribution. I will soon (I promise, very soon) commit Drigg's code to Drupal.
Bye,
Merc.
P.S.
It's also fixed in CVS
Comment #3
mercmobily commentedHi,
Sorry, since it's fixed... marking it as fixed
Merc.
Comment #4
rek2 commentedThanks!!
Cheers
Comment #5
(not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.