Search gives many different results, most close probable being this thread http://drupal.org/node/51850 of two years old related to 4.x versions and that actually gives no hope for me. Since this old problem still persists and as they supposed in the mentioned discussion that the issue might be related to MySQL 5, I am creating here new ticket.

So what I did was to install http://drupal.org/project/private_nodes with no any other related to access setting module and got for every other anonymous and authorized users except user #1 the following error message:

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

(blog_node_access is because this is happening in one of sites of multisite installation with prefixed database. if this matters)

In order to get rid of this message, I tried to uninstall the module, update.php, reset cache, tried the module maintainers code here http://drupal.org/node/183012#comment-647832, alas nothing helped - the error is still persists for all users except user #1.

My environment is:

Drupal 5.8-dev
Configuration file Protected
Cron maintenance tasks Last run 31 мин 26 сек ago
You can run cron manually.
Database schema Up to date
File system Writable (public download method)
MySQL database 5.0.45
PHP 5.2.5
PHP register globals Отключено
Unicode library PHP Mbstring Extension
Web server Apache

Please share if anyone have a suggestion.

Comments

yngens’s picture

Project: Drupal core » Advanced Profile Kit
Version: 5.x-dev » 5.x-1.x-dev
Component: mysql database » Code

I started to turn off installed modules one by one and found that advanced profile causes this 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 blog_node_access na ON na.nid = node.nid WHERE (na.grant_view >= 1 AN' at line 1 query: INNER JOIN blog_node_access na ON na.nid = node.nid WHERE (na.grant_view >= 1 AND ((na.gid = 0 AND na.realm = 'all'))) LIMIT 0, 5 in /home/mysite/public_html/includes/database.mysql.inc on line 172.

If I turn advanced profile without its dependencies this error appears, but if I turn it off and turn on all other modules including those from and on which advanced profile module depends, then everything works without the error caused.

So now I am confused where this issue relates - to mysql database version or to advanced profile module. But since turning on and off method points to Advanced Profile Kit module, I am changing the issues project.

Choosing Version 5.x-1.x-dev, but actually the error appears on both dev and 5.x-1.0-alpha3 versions.

michelle’s picture

Project: Advanced Profile Kit » Private nodes
Category: bug » support

Advprofile has nothing to do wiith either blogs or node access control. I'm guessing it has something to do with that private nodes module you mentioned since that sounds like an access control module. Moving it there.

Michelle

yngens’s picture

Thank you Michelle. IF you believe so, then I have to just wait. However, I would like to mention that I have disabled and removed private nodes. And after this among remaining modules only advanced profile's presence causes the error.

yngens’s picture

Project: Private nodes » Drupal core
Version: 5.x-1.x-dev » 5.x-dev
Component: Code » base system

Since Michelle thinks this is not relevant to Advanced Profile Kit module and since the error persists after removing Private nodes module, I am moving the issue to the base system, where discussion about similar issue belongs: http://drupal.org/node/51850

michelle’s picture

There must be some other access control module there, then. Advanced profile doesn't rewrite any queries for node access and that's what you've got going on there. Something is checking the access control on blogs and messing up a query. I don't know what, but it's not advprofile.

Michelle

yngens’s picture

Michelle, thank you and I totally believe you. Because you know what your module does or does not do. Thats is why after your post, I went ahead and checked off all the modules and started to turn them back one by one. And I found strange dependency of tandem of two modules - Views and Advanced Profile Kit - to cause this error. If these two modules are turned on together then the error is there, but if any of these modules is turned on with the other turned off, then the error goes away.

I am not a coder, dare to say experienced Drupal tester and user, and the farthest I could achieve is to find out this dependency. Here I am stuck, since I don't know what to do next.

And believe me I have turned off all the modules, including those who might have effect to access control. I can send you an access to my site, in case if you want to take a look at yourself. But knowing that you are busy developing and taking care so many important modules, I don't insist.

yngens’s picture

Once again to summarize, I have all the modules, including system ones, turned off. I have only three modules at steak: Views, APK (Advanced Profile Kit) and (Panels). Panels is there because APK requires it when activated. However, PAnels is not to blame for the error, because when APT turned off, but Views and Panel are turned on the error is not there.

So the error appears only when APK and Views are turned together. If one of them turned on and the other is off, then the error is not there.

macgirvin’s picture

If you've got a Unix like box, try "grep -R na.nid *" from the Drupal base to help figure out what is messing up. I have one hit showing up in my installation in a different module (content_access) but not with the same precise SQL syntax. I agree that it sounds like an access control module is at fault. Perhaps the module removal didn't completely remove something(?).

I don't see this SQL or anything resembling it in Drupal core. I also fail to find it in fresh downloads of AdvProfile and private_nodes.

yngens’s picture

thank you macgirvin. i've just solved my problem by installing devel module and within it reinstalling system module. but before coming to system module from the top of the list, i reinstalled lot's of other modules and that's why lot's of things are messed up on my site now. but what it is important to me is that i've got rid of that persisting error message. everything else can be tweaked again.

when i have time i will try to reproduce this error, the strangest that i've run ever since i started to use drupal...

ainigma32’s picture

Status: Active » Fixed

Problem solved so setting to fixed.

- Arie

Status: Fixed » Closed (fixed)

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