Closed (fixed)
Project:
Content Access
Version:
5.x-1.2
Component:
Code
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
8 Oct 2007 at 12:27 UTC
Updated:
2 Sep 2009 at 01:07 UTC
Hi,
Anonymous visitors get SQL error when viewing any URL in the site:
user warning: Unknown table 'n' in on clause query: SELECT node.title, node.nid, node.changed FROM node INNER JOIN term_node ON node.nid = term_node.nid 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 = 'content_access_rid'))) AND ( term_node.tid = 1 AND node.status = 1 AND node.moderate = 0 AND node.promote = 1 ) ORDER BY node.created DESC LIMIT 5 in /srv/squared/www/newsite.squaredesign.nl/includes/database.mysql.inc on line 172
I tested in two environments with identical Drupal setup.
ACL module is not used.
Comments
Comment #1
keesje commentedWould someone edit my post, and remove the explicit file path in the message?
Thanks.
Kees
Comment #2
keesje commentedThere seems to be a lot goin on with "Unknown table 'n' " regarding Drupal modules. So much posts and treads, I can't see a solution.
Comment #3
keesje commentedSaving the access control tab from a content type, results in this errormessage:
user warning: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'FROM node n WHERE type = 'page'' at line 1 query: SELECT .nid FROM node n WHERE type = 'page' in C:\wamp\www\square\includes\database.mysql.inc on line 172.
Comment #4
keesje commentedIt get's worse,
even disabling, end un-installing the module does not help. The only things I changed, was installing this module, and the core 'upload' module. I did this two times, on different servers, with same result.
Even stranger: nodes added after uninstalling the module, is causing them to be not alowed from view by anonymous users. The old nodes are, all URL's are showing the SQL error.
Quick conclusion:
content access is changing Drupal's default per-node access settings?
Does this sound familiar to anyone?
Comment #5
keesje commentedMore info:
node_access table gets altered. When restoring default value,
INSERT INTO `node_access` VALUES (0, 0, 'all', 1, 0, 0)
sql error disappears. when adding this line to altered table, access restrictions don't work anymore. I can understand this. I cannot understand what's happening causing the error message, but I guess this info must be close to the problem cause.
Comment #6
keesje commentedReading through all the related content on this matter, it occurs to me that this could be caused by some other module, or code containing SQL statements. Changing to support request.
Comment #7
fagoyep, this is a problem with queries that doesn't alias the node table to 'n' but use db_rewrite_sql, then the query fails when a node access module is used.
Comment #8
AndrewJarvis commentedSo... what do we do? I'm having the same problem
Comment #9
AndrewJarvis commentedOh, and by the way - I never used the Content Access module
Comment #10
keesje commentedIn my case, I used a PHP snippet from someone else:
http://drupal.org/node/58861
It tricked me on the "db_rewrite_sql" part, only in combination with some access control enhancement module.
I just removed the "db_rewrite_sql" statement, because access control is not relevant in this case.
Looking at your SQL message, it could be that you used the same code snippet...
Anyway, this discussion is out of place in this issue queue. Please move to forum if you want to discuss further.
Luck,
Kees
Comment #11
(not verified) commentedComment #12
oddible commentedNot sure why this was closed. Content Access is adding its INNER JOIN clause in the wrong place, it is getting attached to a clause that doesn't have the node table referenced. I see similar issues posted that are not the same as this, I am surprised to see that this one got sidetracked by bad analysis. Content Access consistently has problems if a View is built on a compound query.