Mysql 5.0.12 and up has changed the join semantics slightly. This patch fixes a place where the use of db_rewrite_sql could potentially generate the error: "Unknown column 'n.nid' in 'on clause'", when the node_privacy_byrole module (or a different access control module) is active.

For more info see: http://drupal.org/node/43735#comment-92865

CommentFileSizeAuthor
image.module_13.patch825 bytesstarbow

Comments

chook’s picture

Title: Mysql 5 & db_rewrite_sql issue » Doesn't work for me...

I'm using simple access and I've been waiting for a patch to come along for this, but when I log out here is what i see.

Fatal error: Unknown column 'n.nid' in 'on clause' query: SELECT DISTINCT(n.nid), n.title, n.body, f.* FROM files f INNER JOIN node_access na ON na.nid = n.nid , node n WHERE (na.grant_view = 1 AND CONCAT(na.realm, na.gid) IN ('all0','simple_access0')) AND f.nid = n.nid AND f.fid = 7 in /home/.haywire/gourd/masha.barashek.org/includes/database.mysql.inc on line 66

chook’s picture

Title: Doesn't work for me... » Mysql 5 & db_rewrite_sql issue - patch works for node privacy by role

Sorry if I'm putting this into the wrong place.

I just tried it out with the node_privacy_by_role module and it seems to work fine.

starbow’s picture

This patch only fixes the problem in respect to the image.module. The logout issue is another manifestation of the same underlying problem, but this patch will not fix it.
I think it's been fixed at the source for 4.7, but still crops up all over the place in 4.6.

drewish’s picture

Status: Needs review » Closed (fixed)

This version is no longer supported. If this issue is occurring with a more recent version please open a new issue.