I noticed this error in Recent log entries (admin/reports/dblog).
Unknown column 'tn.status' in 'where clause' query: SELECT count(tn.nid) AS cnt FROM design6_term_node tn WHERE tn.tid = 17 and tn.status = 1 in /dlc/drupal-6.1/sites/all/modules/taxonews/taxonews.module
The SQL statement in function blockList() uses an undeclared column for {term_node}.
$sq = 'SELECT count(tn.nid) AS cnt '
. 'FROM {term_node} tn '
. 'WHERE tn.tid = %d and tn.status = 1 ';
Substituted the following SQL code to correct the problem as the reference to the {node} is missing.
$sq = 'SELECT count(n.nid) AS cnt '
. 'FROM {node} n '
. ' INNER JOIN {term_node} tn ON n.nid = tn.nid AND n.vid = tn.vid '
. 'WHERE tn.tid = %d '
. ' AND n.status = 1 ';
NOTE: Replaced the SQL the statement in the function archiveExists() with the same SQL statement I patched into blocklist(). Otherwise the archive count returned is incorrect as there may be multiple versions for a node in {term_node} and the status of the node needs to be '1' as is the case when the nodes are selected in function blockView().
* @version CVS: $Id: taxonews.module,v 1.10.8.5 2007/10/27 13:02:17 fgm Exp $
Comments
Comment #1
fgmThanks for the suggestion. Today's new version changes most requests. Such joins are now just on n.vid = tn.vid, as the n.nid = tn.nid is redundant.
Comment #2
Anonymous (not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.