I'm getting numerous errors in my logs

Unknown column 'node.nid' in 'field list' query: SELECT node.nid, node.created FROM drupal_node WHERE node.type = 'blog' AND node.status = 1 AND node.uid = 5 ORDER By node.created DESC in /xxxxxx/xxxxxxx/xxxxxxxx/sites/all/modules/advanced_blog/advanced_blog.module on line 391.

Unknown column 'node.nid' in 'field list' query: SELECT node.nid, node.created FROM drupal_node WHERE node.type = 'blog' AND node.status = 1 AND node.uid = 58 ORDER By node.created DESC in /xxxxx/xxxxx/xxxxxxx/sites/all/modules/advanced_blog/advanced_blog.module on line 391

Seems problems with this line in the module -

$result = db_query(db_rewrite_sql($query));

Comments

shanwa’s picture

I have similar errors on the blog page when access with non-default language:

user warning: Unknown column 'n.language' in 'where clause' query: SELECT node.nid, node.created FROM node WHERE (n.language ='en' OR n.language ='' OR n.language IS NULL) AND ( node.type = 'blog' AND node.status = 1 AND node.uid = 4 )ORDER By node.created DESC

in .../sites/all/modules/advanced_blog/advanced_blog.module on line 390.

design.er’s picture

I have to subscribe -> have the same error.

marcus0263’s picture

More SQL errors in the logs
Unknown column 'atom' in 'where clause' query: SELECT n.nid, n.created, YEAR(FROM_UNIXTIME(n.created)) AS year, MONTH(FROM_UNIXTIME(n.created)) AS month, DAY(FROM_UNIXTIME(n.created)) AS day FROM drupal_node n WHERE n.type = 'blog' AND n.status = 1 AND n.uid = 1 AND YEAR(FROM_UNIXTIME(n.created)) = atom ORDER BY n.title asc LIMIT 0, 20 in /xxxxx/xxxxxx/drupal-6.12/sites/all/modules/advanced_blog/advanced_blog.module on line 601.

rsm08’s picture

At least in the language case, the problem occurs because the language module expects to find "n" as the node alias in the query. But since there's no other tables than the node table, we can omit aliasing.

So change line 389 from:

$query = "SELECT node.nid, node.created FROM {node} WHERE node.type = 'blog' AND node.status = 1 AND node.uid = " . $account->uid . " ORDER By node.created DESC";
to:
$query = "SELECT nid, created FROM {node} n WHERE type = 'blog' AND status = 1 AND uid = " . $account->uid . " ORDER By created DESC";

and the problem is solved!

JStarcher’s picture

Thanks rsm08, that fixed the error I was getting:

user warning: Unknown column 'n.nid' in 'on clause' query: SELECT node.nid, node.created FROM node INNER JOIN node_access na ON na.nid = n.nid WHERE (na.grant_view >= 1 AND ((na.gid = 0 AND na.realm = 'all') OR (na.gid = 1 AND na.realm = 'workflow_access') OR (na.gid = 0 AND na.realm = 'workflow_access_owner'))) AND ( node.type = 'blog' AND node.status = 1 AND node.uid = 7 )ORDER By node.created DESC in /Applications/MAMP/htdocs/bo/sites/all/modules/advanced_blog/advanced_blog.module on line 390.

svendecabooter’s picture

Status: Active » Fixed

The improper usage of the DB API in this module has been fixed. This should resolve the errors mentioned in this issue.
Please test with the new release of this module that will be out soon, or check out latest code from CVS.

Status: Fixed » Closed (fixed)

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