recipe.module,v 1.31.2.5 2004/12/08

when anonymous user access http://sitename/recipe, the following error occurs,

Fatal error: You have an error in your SQL syntax near 'ON (na.nid = 0 OR na.nid = n.nid) WHERE na.grant_view = 1 AND CONCAT(na.realm, n' at line 1 query: SELECT COUNT(*) FROM node n INNER JOIN users u ON n.uid=u.uid INNER JOIN recipe r ON n.nid = r.nidINNER JOIN node_access na ON (na.nid = 0 OR na.nid = n.nid) WHERE na.grant_view = 1 AND CONCAT(na.realm, na.gid) IN ('all0') AND n.type = 'recipe' in includes/database.mysql.inc on line 125

Comments

DrMoxie’s picture

Users other than the administrator account encounter the following error when visiting ?q=recipe:

user error: Unknown column 'r.nidINNER' in 'on clause' query: SELECT COUNT(*) FROM node n INNER JOIN users u ON n.uid=u.uid INNER JOIN recipe r ON n.nid = r.nidINNER JOIN node_access na ON (na.nid = 0 OR na.nid = n.nid) WHERE na.grant_view = 1 AND CONCAT(na.realm, na.gid) IN ('all0') AND n.type = 'recipe' in /var/www/snacky/includes/database.mysql.inc on line 125.

Is there a fix for this? It appears to be permissions based....

gkrishna’s picture

in function_recipe_list() {

replace $result = "... sql query "

with

$result = pager_query("SELECT n.nid, n.title, n.uid, u.name, r.notes FROM {node} n INNER JOIN {users} u ON n.uid=u.uid INNER JOIN {recipe} r ON n.nid = r.nid WHERE n.type = 'recipe' ORDER BY n.created DESC", 20);

yelvington’s picture

I've encountered similar problems -- SQL queries where spaces are omitted -- in interactions among several modules. Recipe, events and gallery2 come to mind. It begins to point to some fundamental bug, but I don't have enough evidence yet and don't understand enough about how SQL queries are constructed internally.

moshe weitzman’s picture

fixed in HEAD

syscrusher’s picture

I posted a patch with this issue: http://drupal.org/node/18718 which fixes the problem in 4.5 (not HEAD) that was reported in follow up #1 by DrMoxie here.

Anonymous’s picture