MySQL Error : You have an error in your SQL syntax

vipconsult - February 6, 2008 - 23:02
Project:Nodeaccess
Version:6.x-1.3
Component:Code
Category:support request
Priority:minor
Assigned:Unassigned
Status:active
Description

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 = 1 AND na.realm = 'nodeaccess_rid') OR (na.gid = 0 AND na.realm = 'nodeaccess_uid') OR (na.gid = 0 AND na.realm = 'nodeaccess_author'))) in /home/finestam/public_html/includes/database.mysql.inc on line 172.

I get this when using with product content type.
And only for Anonymous users

MySQL version 4.1.22-standard
Apache version 1.3.39 (Unix)
PHP version 5.2.4

I think has something to do with the Mysql version as I get this error with all node access typy Modules.
I tried all of them !

#1

ttosttos - March 20, 2008 - 18:15

I do get the same error in the grant tab every time I search for a non-existent user after having searched an existent user.
"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 ')' at line 1 query: SELECT uid, name FROM users WHERE name LIKE '%john%' AND uid NOT IN () in /opt/lampp/htdocs/main/includes/database.mysql.inc on line 172."
I can be reproduced consistently.

#2

mantyla - July 2, 2008 - 15:17
Priority:critical» minor
Assigned to:vipconsult» Anonymous

@vipconsult: As you said yourself, there is probably something wrong with your setup. That piece of sql code is not from Nodeaccess, but looks like something generated by Drupal core. It refers to nodeaccess realms, true, but this is because the core function has been supplied them by Nodeaccess exactly like it is supposed to. The fact that you have this problem with all node access modules is further proof of this. I'd recommend installing the latest version of Drupal 5.x, as the problem lies within the core - that, or your system setup, which seems legit, if somewhat outdated.

@ttosttos: That is a known problem, at least to me. The reason for it is that when the user array becomes empty the program neglects to check the size of the array and tries to feed its contents into the sql query, resulting in flawed sql code. The same problem should appear whenever you remove every user and then try to search for new ones. I have fixed this in my personal version, but it has yet to be fixed in the official version.

#3

mantyla - July 22, 2008 - 08:57
Status:active» closed

Problem fixed in the current version.

#4

NigelCunningham - October 21, 2009 - 21:40
Version:5.x-1.x-dev» 6.x-1.3
Status:closed» active

I am seeing this same issue with 6.x-1.3. Mantyla, would you post the patch you used and I'll see if it addresses the issue for me.

Regards,

Nigel

 
 

Drupal is a registered trademark of Dries Buytaert.