Referring to this Multiple Node Access logic patch (http://drupal.org/node/196922) ...firstly, I have patched properly. secondly I don't have OG installed. I don't think I use other modules that uses node access. Just in case, I have rebuilt node permissions on the site. Clear cache, and look at anonymous page. Same error.

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 'INNER JOIN node_access na ON na.nid = node.nid WHERE (na.grant_view >= 1 AND ((n' at line 1 query: INNER JOIN node_access na ON na.nid = node.nid WHERE (na.grant_view >= 1 AND ((na.realm = 'all' AND na.gid = 0) OR (na.realm = 'domain_site' AND na.gid = 0) OR (na.realm = 'domain_id' AND na.gid = 0)) ) LIMIT 0, 5 in /home/golfingi/public_html/drupal/includes/database.mysql.inc on line 172.

Using Devel Module, these are queries being made on this page :

query
SELECT node.nid, node.created AS node_created_created, node.title AS node_title, node.changed AS node_changed FROM {node} node LEFT JOIN {node_access} domain_access ON node.nid = domain_access.nid AND domain_access.realm = 'domain_id' WHERE (node.type IN ('announcement')) AND (node.status = '1') AND (domain_access.gid IN ('0')) ORDER BY node_created_created DESC

countquery
SELECT count(node.nid) FROM {node} node LEFT JOIN {node_access} domain_access ON node.nid = domain_access.nid AND domain_access.realm = 'domain_id' WHERE (node.type IN ('announcement')) AND (node.status = '1') AND (domain_access.gid IN ('0'))

How do I go about using "Devel Module Node Access" to look into this issue?
Under " node_access entries for nodes shown on this page" i am getting status all Ok. What I should looking/concern at?

Comments

agentrickard’s picture

Status: Active » Postponed (maintainer needs more info)

The two queries that you report below are not the same as the first error that you report -- can you get a full report of that faulty query?

Are these Views generated pages? I don't believe these second two queries come directly from the multiple node access patch.

This part of the query leads me to believe that:

WHERE (node.type IN ('announcement')) AND (node.status = '1') AND (domain_access.gid IN ('0')) ORDER BY node_created_created DESC

The node.type IN is not something that multiple node access would add, so I suspect this is a query coming from something else.

Also note that MNA patch will not work prior to MySQL 4.1.

najibx’s picture

1. Yes, the two queries are not the same as the errors. The queries provided above are output of Views page. But Errors POP UP everywhere. On simple page, search results...not just on View's page.

2. Upon further investigation, earlier I manually changed the "domain_id" via PHPmyadmin so i can have a proper listing purpose and allowing to add new domain later on to a particular group/arrangement. i.e Group 1 start with 0, group 2 starts with 30 and group 3 starts with 50. Since I only change/delete entries in table `domain`, I didn't do anything on other tables such as `node_access`. This is probably the cause. Oh mannnnnn, i think I really in a messed now, as there are many other nodes have been added with some node access (being published to certain domains).

So, got a clue how can I fix this, without rebuild everything....

6. BTW, my server specs :
Apache version 1.3.41 (Unix)
PHP version 5.2.5
MySQL version 5.0.51a-community

agentrickard’s picture

Status: Postponed (maintainer needs more info) » Closed (fixed)

OK. So this is self-inflicted. Sorry.

See section 6 (esp. 6.3 and 6.4) of the README for an explanation of what all the node access rules mean.

najibx’s picture

I end up disable and uninstall all Domain Access modules. This processes deleted relevant tables and empty node_access table.
No more errors for anonymous.

so, now, I reinstall Domain Access. I am getting back the errors! When, I try to configure the root domain, I got duplicate errors for the first time. i do this several times, and so clueless ....

najibx’s picture

Status: Closed (fixed) » Active

From log message :

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 'INNER JOIN node_access na ON na.nid = node.nid WHERE (na.grant_view >= 1 AND ((n' at line 1 query: INNER JOIN node_access na ON na.nid = node.nid WHERE (na.grant_view >= 1 AND ((na.realm = 'all' AND na.gid = 0) OR (na.realm = 'domain_site' AND na.gid = 0) OR (na.realm = 'domain_id' AND na.gid = 0)) ) LIMIT 0, 5 in /home/golfingi/public_html/drupal/includes/database.mysql.inc on line 172.

I would do whatever it takes to rectify the problems. As you see above I uninstall and reinstall Domain Access.

najibx’s picture

Status: Active » Closed (fixed)

I have not been so frustrated and happy at the same time for a long time.
Today is the day .... Somehow there's a block that are enabled and missing something ....

I get this clue because of "LIMIT 0, 5" in the queries error.... this queries must be generated by Views block or some kind of block.
There !!!

alhamdulillah .....

Thanks and sorry Ken for troubling you.

Lesson of the day ...hmm ... u figure it out.

lappies’s picture

Thanks for pointing this issue out of the blocks.
I found that the two blocks "My Blogs" as well as "My Posts" gave this above error for anonymous user. After disabling it, error gone.
(Obvious I did no have the same setup as discussed above and did not even use domain access module, but Thanks for helping me, maybe this two error-giving-blocks can help and point someone else as well.)
Have a good day-
from a happy drupaler

mdlepage’s picture

I wanted to add my findings to this problem, as I did a ton of searching for a solution and this post did the trick.

To solve the following SQL error (similar but a little different than the one above) that I was receiving on the login screen:

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 'INNER JOIN node_access na ON na.nid = node.nid WHERE (na.grant_view >= 1 AND ((n' at line 1 query: INNER JOIN node_access na ON na.nid = node.nid WHERE (na.grant_view >= 1 AND ((na.gid = 0 AND na.realm = 'all') OR (na.gid = 0 AND na.realm = 'simple_access') OR (na.gid = 0 AND na.realm = 'simple_access_author'))) LIMIT 0, 99 in /home/cpmdev/includes/database.mysql.inc on line 172.

Here's what I did:
1) Create a development site, a copy of my production site
2) Manually disabled each block one at a time and check the login screen for the error message, until I found the block causing the problem.

The very last block was the culprit (ironic). It was created by a view. I found that in the argument field of the view, the following code was causing the error:
$args[0] = arg(1);

I did some digging and I believe this line is used in for panels, but I not quite sure why yet. I'll make the change in production later today.

Thanks!