If you edit and save a session as a session owner and you are not an administrator you can get this error.

Unknown column 'n.nid' in 'on clause' query:
SELECT DISTINCT node.nid AS nid, node.title AS title, node.type AS
type, r.field_session_room_nid AS room_nid, node2.title AS room_title
FROM node node INNER JOIN content_field_session_room r ON r.nid =
node.nid AND r.vid = node.vid AND r.field_session_room_nid IN (11)
INNER JOIN node node2 ON r.field_session_room_nid = node2.nid INNER
JOIN content_field_session_slot s ON s.nid = node.nid AND s.vid =
node.vid AND s.field_session_slot_nid IN (20) 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 = 4 AND na.realm =
'nodeaccess_userreference') OR (na.gid = 4 AND na.realm =
'nodeaccess_userreference_author') OR (na.gid = 1 AND
na.realm = 'nodeaccess_userreference_all'))) AND ( node.nid
!= 248 ) in _db_query() (line 147 of
/var/www/badcamp2011/live/includes/database.mysqli.inc).

Patch will be attached.

Comments

redndahead’s picture

Status: Active » Needs review
StatusFileSize
new923 bytes
redndahead’s picture

There is another option switch the node alias from node to n Not sure of what other consequences there may be.

redndahead’s picture

StatusFileSize
new1.36 KB

Here is the other patch.

coltrane’s picture

This looks legit, but I haven't been able to reproduce in dev or beta2. Can you reliably reproduce?

daniel-san’s picture

I was getting this same kind of error when a user with Session Organizer role would schedule the room and time for the session that was submitted by an other authenticated user.

I just applied patch from Comment #1 and tested the same scenario. I worked perfectly - no errors.

jcinteractive’s picture

Had this exact issue yesterday as well. Applied the first patch and it solved the problem.

greggles’s picture

This looks good to me too. I think it's only a problem if you have a node access module enabled, which is why only some people see it.

This patch applied for me via patch -p1 with a rejected hunk related to whitespace. Some of the columns at the start of the query were also still using node. instead of n.

Re-roll attached. I didn't test it.

greggles’s picture

StatusFileSize
new1.38 KB
ezra-g’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

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