Drupal 6.11.

Storm is working fine for admin. For other users, it throws this SQL error, or a variation:

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 '1,0) FROM stormorganization sor1 WHERE sor1.vid=n.vid) WHEN 'stormproject' THE' at line 1 query: SELECT DISTINCT(n.nid) FROM node n 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 = 0 AND na.realm = 'og_public') OR (na.gid = 0 AND na.realm = 'tac_lite') OR (na.gid = 9 AND na.realm = 'tac_lite'))) AND (( CASE n.type WHEN 'stormorganization' THEN (SELECT IF(n.uid=11 OR sor1.nid=,1,0) FROM stormorganization sor1 WHERE sor1.vid=n.vid) WHEN 'stormproject' THEN 0 ELSE 1 END )=1 ) AND ( n.status = 1 AND n.nid IN (64)) in /home/folio/public_html/cydeck.com/includes/menu.inc on line 1006.

Looking at prior issues, I suspected that this was related to authenticated user access. But I activated auth user access to all Storm modules without success. I have uninstalled and reinstalled Storm. I have updated all modules and rebuilt permissions. I have a faint, distant memory of experiencing this before and fixing it, but I'm stumped now.

Appreciate any help. Thanks.

Comments

Magnity’s picture

Status: Active » Postponed (maintainer needs more info)

Looks like the SQL error is due to the THE', which should be a THEN. However, due to the node access modules you are running, it is extremely hard to tell whether this issue comes from Storm, or something else.

Does the issue go away if the node access modules are disabled? If so, the issue is unlikely to be with Storm.

gjmokcb’s picture

Thanks for the good catch on THE. With Storm enabled and CCK Content Permissions disabled, I still get the error. My only other node permissions module is Taxonomy Lite, but there is no vocabulary for Storm nodes. So I'm puzzled.

Magnity’s picture

There is mention of tac_lite in the SQL so it is definitely doing something to the query.

However, I'll state that we have had issues with tac_lite before - and it boils down to the fact the effect of running multiple node access modules is fairly undefined. I think this is stated in the README...

gjmokcb’s picture

Disabled tac_lite and rebuilt permissions. Error msg now is:

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 '1,0) FROM stormorganization sor1 WHERE sor1.vid=n.vid) WHEN 'stormproject' THE' at line 1 query: SELECT DISTINCT(n.nid) FROM node n 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 = 0 AND na.realm = 'og_public'))) AND (( CASE n.type WHEN 'stormorganization' THEN (SELECT IF(n.uid=11 OR sor1.nid=,1,0) FROM stormorganization sor1 WHERE sor1.vid=n.vid) WHEN 'stormproject' THEN 0 WHEN 'stormtask' THEN (SELECT IF( n.uid=11 OR sta1.organization_nid=,1,0) FROM stormtask sta1 WHERE sta1.vid=n.vid) WHEN 'stormticket' THEN (SELECT IF( n.uid=11 OR sti1.organization_nid=,1,0) FROM stormticket sti1 WHERE sti1.vid=n.vid) WHEN 'stormtimetracking' THEN (SELECT IF(n.uid=11 OR stt1.organization_nid=,1,0) FROM stormtimetracking stt1 WHERE stt1.vid=n.vid) ELSE 1 END )=1 ) AND ( n.status = 1 AND n.nid IN (64)) in /home/folio/public_html/cydeck.com/includes/menu.inc on line 1006.

I note that the THE[N] error is well before tac_lite. It does seem to be involved with either na.xxx, which I assume is node access, or the prior section, which is Storm. I'm no SQL expert, but it almost looks like a chunk of the query got dropped between "THE" and " ' at line". That would seem to mean that the Storm query that begins the error msg: ... FROM ... WHERE ... WHEN ... THE[N] got truncated somehow. Invalid elements? I don't know, but that tends to make me think the problem is in Storm somewhere.

Magnity’s picture

Which pages does this error appear on?

Do you have any other node access control modules running? (Or access control APIs?).

Whatever is causing the issue, its easiest if we can strip out as much of the other stuff as possible...

gjmokcb’s picture

pretty much every page. The error msg I quoted appears after login. The user logs in and a rule redirects them. The redirect rule is acting weird right now, and I'm working on that, but it doesn't seem to be the source of the problem. Having logged in, if the user navigates to the home page, a gigantic error msg appears (note that I have reinstalled tac_lite)

* 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 '1,0) FROM stormorganization sor1 WHERE sor1.vid=node.vid) WHEN 'stormproject' ' at line 10 query: SELECT DISTINCT(node.nid) AS nid, node.title AS node_title, node_data_field_overview.field_overview_value AS node_data_field_overview_field_overview_value, node_data_field_overview.field_overview_format AS node_data_field_overview_field_overview_format, node.type AS node_type, node.vid AS node_vid, DATE_FORMAT((FROM_UNIXTIME(node.created) + INTERVAL -14400 SECOND), '%Y%m%d') AS node_created_day FROM node node LEFT JOIN content_type_requests node_data_field_overview ON node.vid = node_data_field_overview.vid 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 = 'og_public') OR (na.gid = 0 AND na.realm = 'tac_lite') OR (na.gid = 9 AND na.realm = 'tac_lite'))) AND (( CASE node.type WHEN 'stormorganization' THEN (SELECT IF(node.uid=11 OR sor1.nid=,1,0) FROM stormorganization sor1 WHERE sor1.vid=node.vid) WHEN 'stormproject' THEN 0 ELSE 1 END )=1 ) AND ( (node.type in ('requests')) AND (node.created > 1243808342-5184000) )ORDER BY node_created_day DESC LIMIT 0, 10 in /home/folio/public_html/cydeck.com/sites/all/modules/views/includes/view.inc on line 731.
* 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 '1,0) FROM stormorganization sor1 WHERE sor1.vid=node.vid) WHEN 'stormproject' ' at line 8 query: SELECT DISTINCT(node.nid) AS nid, node.title AS node_title, node_revisions.body AS node_revisions_body, node_revisions.format AS node_revisions_format, DATE_FORMAT((FROM_UNIXTIME(node.created) + INTERVAL -14400 SECOND), '%Y%m%d') AS node_created_day FROM node node LEFT JOIN node_revisions node_revisions ON node.vid = node_revisions.vid 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 = 'og_public') OR (na.gid = 0 AND na.realm = 'tac_lite') OR (na.gid = 9 AND na.realm = 'tac_lite'))) AND (( CASE node.type WHEN 'stormorganization' THEN (SELECT IF(node.uid=11 OR sor1.nid=,1,0) FROM stormorganization sor1 WHERE sor1.vid=node.vid) WHEN 'stormproject' THEN 0 ELSE 1 END )=1 ) AND ( (node.type in ('offers')) AND (node.created > 1243808342-5184000) )ORDER BY node_created_day DESC LIMIT 0, 10 in /home/folio/public_html/cydeck.com/sites/all/modules/views/includes/view.inc on line 731.
* 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 '1,0) FROM stormorganization sor1 WHERE sor1.vid=node.vid) WHEN 'stormproject' ' at line 8 query: SELECT DISTINCT(node.nid) AS nid, node.title AS node_title, node_revisions.teaser AS node_revisions_teaser, node_revisions.format AS node_revisions_format, DATE_FORMAT((FROM_UNIXTIME(node.created) + INTERVAL -14400 SECOND), '%Y%m%d') AS node_created_day FROM node node LEFT JOIN node_revisions node_revisions ON node.vid = node_revisions.vid 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 = 'og_public') OR (na.gid = 0 AND na.realm = 'tac_lite') OR (na.gid = 9 AND na.realm = 'tac_lite'))) AND (( CASE node.type WHEN 'stormorganization' THEN (SELECT IF(node.uid=11 OR sor1.nid=,1,0) FROM stormorganization sor1 WHERE sor1.vid=node.vid) WHEN 'stormproject' THEN 0 ELSE 1 END )=1 ) AND ( (node.type in ('information')) AND (node.created > 1243808342-5184000) )ORDER BY node_created_day DESC LIMIT 0, 10 in /home/folio/public_html/cydeck.com/sites/all/modules/views/includes/view.inc on line 731.
* 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 '1,0) FROM stormorganization sor1 WHERE sor1.vid=n.vid) WHEN 'stormproject' THE' at line 1 query: SELECT DISTINCT(n.nid) FROM node n 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 = 0 AND na.realm = 'og_public') OR (na.gid = 0 AND na.realm = 'tac_lite') OR (na.gid = 9 AND na.realm = 'tac_lite'))) AND (( CASE n.type WHEN 'stormorganization' THEN (SELECT IF(n.uid=11 OR sor1.nid=,1,0) FROM stormorganization sor1 WHERE sor1.vid=n.vid) WHEN 'stormproject' THEN 0 ELSE 1 END )=1 ) AND ( n.status = 1 AND n.nid IN (64)) in /home/folio/public_html/cydeck.com/includes/menu.inc on line 1006.

My permissions modules are node access and tac_lite. Other access-type modules are organic groups (projects are not an og node or content type) and IMCE (files, not nodes).

I really appreciate your help on this. I'm going to whack the rules again and see if anything happens.

gjmokcb’s picture

Disabled all rules. No change. It may haveto do with permissions (since user 1 is unaffected), but it really seems to be somewhere inside Storm. But to be fair, it could be a confllict between Storm and another module, not an inadequacy in Storm. I will fiddle with disabling every module one-by-one, but probably tomorrow. It's getting late here.

Magnity’s picture

It would be really helpful to see these errors with as few other bits in as possible - so without node access or tac_lite. You do not have to uninstall them, simply disable temporarily.

(EDIT - crossed paths with your previous post)

Magnity’s picture

StatusFileSize
new883 bytes

Would you be able to try the attached patch?

A success would not mean the errors totally go away, but simply that they are reduced and it will show whether this is the problem or not.

Magnity’s picture

Status: Postponed (maintainer needs more info) » Needs review

[Status]

gjmokcb’s picture

Disabled tac_lite, content_access, and og_access.

Disabled all Storm modules. Removed all Storm modules. Re-uploaded and installed Storm.

Enabled core Storm module. No error msg.

Enabled Storm attributes module. No error msg.

Enabled Storm Organizations module. This error msg (note that there is no THE[N] 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 '1,0) FROM stormorganization sor1 WHERE sor1.vid=n.vid) ELSE 1 END )=1 ) AND (' at line 1 query: SELECT n.nid FROM node n WHERE (( CASE n.type WHEN 'stormorganization' THEN (SELECT IF(n.uid=11 OR sor1.nid=,1,0) FROM stormorganization sor1 WHERE sor1.vid=n.vid) ELSE 1 END )=1 ) AND ( n.status = 1 AND n.nid IN (64)) in /home/folio/public_html/cydeck.com/includes/menu.inc on line 1006.

gjmokcb’s picture

Also please note that I'm not using a node access module--only the core Drupal permissions, tac_lite, and cck content_access (field-specific permissions). I also use Organic Groups, and have disabled OG_access before running the test above.

Thanks for your help.

Magnity’s picture

Did the patch work at all? It is a very small change, but I think possibly could be the answer.

The THE' was a red herring - me being stupid. That was simply the error message taking a truncated version of the query to display the location of the query.

gjmokcb’s picture

Yikes! Installed the patch, disabled storm org, enabled storm org, now the error msg is:

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 '1,0) FROM stormorganization sor1 WHERE sor1.vid=n.vid) ELSE 1 END )=1 ) AND (' at line 1 query: SELECT DISTINCT(n.nid) FROM node n 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 = 0 AND na.realm = 'tac_lite') OR (na.gid = 15 AND na.realm = 'tac_lite') OR (na.gid = 15 AND na.realm = 'tac_lite') OR (na.gid = 14 AND na.realm = 'tac_lite') OR (na.gid = 17 AND na.realm = 'tac_lite') OR (na.gid = 18 AND na.realm = 'tac_lite') OR (na.gid = 15 AND na.realm = 'tac_lite') OR (na.gid = 14 AND na.realm = 'tac_lite') OR (na.gid = 17 AND na.realm = 'tac_lite') OR (na.gid = 18 AND na.realm = 'tac_lite') OR (na.gid = 15 AND na.realm = 'tac_lite') OR (na.gid = 14 AND na.realm = 'tac_lite') OR (na.gid = 17 AND na.realm = 'tac_lite') OR (na.gid = 18 AND na.realm = 'tac_lite'))) AND (( CASE n.type WHEN 'stormorganization' THEN (SELECT IF(n.uid=11 OR sor1.nid=,1,0) FROM stormorganization sor1 WHERE sor1.vid=n.vid) ELSE 1 END )=1 ) AND ( n.status = 1 AND n.nid IN (64)) in /home/folio/public_html/cydeck.com/includes/menu.inc on line 1006.

gjmokcb’s picture

Sorry--I had re-enabled tac_lite in the meantime. I'll go back and disable it and see what happens.

gjmokcb’s picture

Without tac_lite, it looks like this:

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 '1,0) FROM stormorganization sor1 WHERE sor1.vid=n.vid) ELSE 1 END )=1 ) AND (' at line 1 query: SELECT n.nid FROM node n WHERE (( CASE n.type WHEN 'stormorganization' THEN (SELECT IF(n.uid=11 OR sor1.nid=,1,0) FROM stormorganization sor1 WHERE sor1.vid=n.vid) ELSE 1 END )=1 ) AND ( n.status = 1 AND n.nid IN (64)) in /home/folio/public_html/cydeck.com/includes/menu.inc on line 1006.

Magnity’s picture

Status: Needs review » Needs work

OK - i'll go back to the drawing board.

So that I can try to reproduce this - is it possible to know the permissions for the role that gives this error?

gjmokcb’s picture

The storm permissions are:

Storm access
Storm attribute access
Storm organization access
Storm organization view belonged
Storm organization view own

This user actually has three roles. One has all five listed permissions, the other two only have the first three permissions. The user has many other permissions for other modules.

By the way, I tried deactivating a few other suspicious modules without any result. I have not disabled all modules except storm, because it would make me crazy. But if you have any ideas about potential inter-module conflict, please let me know.

I do remember a module throwing SQL errors off of menu.inc, and I remember that it was easy to fix, but I'm not at all sure it was Storm (I've been building this site for 60 days), and I can't recall what the fix was. I've tried all the obvious stuff, and the prior experience may be entirely unrelated.

Please let me know what else I can do to assist.

Magnity’s picture

I've just tried to reproduce this on my own version with the same permissions - and am not getting any error message, but will keep this in one in mind - it's going to be hard to test if I can't see the problem though!

Would you be able to try using the devel module to track database queries? The useful thing to know is the function where the error occurs... hopefully this would also confirm whether the issue is within Storm - although I suspect it is.

gjmokcb’s picture

I have forwarded access info to you by PM. You will find that the site has several tricky modules, and being 6.x, some of those are in dev. So it is entirely possible that the problem is not within Storm itself, but I just can't figure that out without the in-depth knowledge of Storm that you have. As mentioned in the PM, I look forward to making a contribution to the Storm Project.

Thanks for all your help.

Magnity’s picture

Component: Storm.module » Storm Organization
Priority: Critical » Normal
Status: Needs work » Patch (to be ported)
StatusFileSize
new1.04 KB

http://drupal.org/cvs?commit=220304

Basically - if the access_sql function is called without giving an organization argument - an error occurs because it can't figure out whether the user belongs to this non-organization.

Marking as tbp to see whether other Storm modules could do with this too.

Magnity’s picture

Status: Patch (to be ported) » Fixed

The workaround has been added to all the Storm modules.

(Multiple commits)

Status: Fixed » Closed (fixed)

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