I just did the update and I got these errors almost immediately.

user warning: Unknown column 'n.nid' in 'on clause' query: SELECT DISTINCT n.title, n.status, b.mlid FROM node n, book b 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 = 11 AND na.realm = 'content_access_author') OR (na.gid = 2 AND na.realm = 'content_access_rid') OR (na.gid = 8 AND na.realm = 'content_access_rid') OR (na.gid = 11 AND na.realm = 'nodeaccess_userreference'))) AND (((SELECT COUNT(1) FROM node_access nasq WHERE na.nid=nasq.nid AND gid=0 AND realm='all') > 0) OR ((SELECT COUNT(1) FROM node_access nasq WHERE na.nid=nasq.nid AND realm IN ('content_access_author','content_access_rid')) = 0 OR (SELECT COUNT(1) FROM node_access nasq WHERE na.nid=nasq.nid AND ((gid=11 AND realm='content_access_author') OR (gid=2 AND realm='content_access_rid') OR (gid=8 AND realm='content_access_rid'))) > 0) AND ((SELECT COUNT(1) FROM node_access nasq WHERE na.nid=nasq.nid AND realm IN ('nodeaccess_userreference')) = 0 OR (SELECT COUNT(1) FROM node_access nasq WHERE na.nid=nasq.nid AND ((gid=11 AND realm='nodeaccess_userreference'))) > 0)) AND ( n.nid = 68 AND b.nid = n.nid) in /var/www/html/ppl/sites/all/modules/advancedbookblocks/advancedbookblocks.module on line 487.
user warning: Unknown column 'n.nid' in 'on clause' query: SELECT DISTINCT mlid, weight, link_title FROM menu_links 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 = 11 AND na.realm = 'content_access_author') OR (na.gid = 2 AND na.realm = 'content_access_rid') OR (na.gid = 8 AND na.realm = 'content_access_rid') OR (na.gid = 11 AND na.realm = 'nodeaccess_userreference'))) AND (((SELECT COUNT(1) FROM node_access nasq WHERE na.nid=nasq.nid AND gid=0 AND realm='all') > 0) OR ((SELECT COUNT(1) FROM node_access nasq WHERE na.nid=nasq.nid AND realm IN ('content_access_author','content_access_rid')) = 0 OR (SELECT COUNT(1) FROM node_access nasq WHERE na.nid=nasq.nid AND ((gid=11 AND realm='content_access_author') OR (gid=2 AND realm='content_access_rid') OR (gid=8 AND realm='content_access_rid'))) > 0) AND ((SELECT COUNT(1) FROM node_access nasq WHERE na.nid=nasq.nid AND realm IN ('nodeaccess_userreference')) = 0 OR (SELECT COUNT(1) FROM node_access nasq WHERE na.nid=nasq.nid AND ((gid=11 AND realm='nodeaccess_userreference'))) > 0)) AND ( plid = 0 )ORDER by weight, link_title in /var/www/html/ppl/sites/all/modules/advancedbookblocks/advancedbookblocks.module on line 469.

Comments

jzornig’s picture

I believe it is caused by incorrect usage of db_rewrite_sql() where the primary table being queried is not {node}.

jdvc’s picture

StatusFileSize
new3.88 KB

I've got the same issue. Attached copy of error.

fugazi’s picture

I've got the same issue.

jvieille’s picture

Same
ABB is broken

jdvc’s picture

I rolled the module back to advancedbookblocks-6.x-2.1 and it seemed to fix the issue, just fyi.

jjancel’s picture

I've got the same issue.
administrators = ok
Visitors = error Unknown column 'n.nid'

ransomweaver’s picture

I also have this problem with 2.2. ok for admin, not for anon.

lucacerone’s picture

Got the same problem..
Rolling back to the old version, I hope this is fixed soon..

jvieille’s picture

either this bug is solved or the current release shall be deprecated

Frodo Looijaard’s picture

Status: Active » Needs review
StatusFileSize
new5.72 KB

The problem seems to be that a lot of db_rewrite_sql statements were added in 2.2 (which is a good thing), but they are not handled in the right way.

If a db_rewrite_sql statement is not working on the {node} table with alias n you have to specify which table and which primary key it is working on. That was everywhere omitted. Also, you should not use multiple table names in a FROM clause, but instead use INNER JOIN clauses.

The attached patch hopefully solves all these problems. Note that it has not been extensively tested and I have not reviewed whether this is functionally correct. But it should at least work and provide some safety.

Frodo Looijaard’s picture

With the attached patch, the i18n module suddenly starts working too. Like with normal books, nodes which are in the wrong language are not displayed in the tree anymore.

advancedbookblocks-2.2-fix-rewrites-2.diff
against 6.x-2.2
advancedbookblocks-2.2-fix-rewrites-inc.diff
against a tree where the former patch has been applied
parasolx’s picture

after applied these patches, my problem solves. everything goes correctly as it does.

bravo for the patches

mpotter’s picture

I also had this same error when using Anonymous user (worked fine for User-1). Tried patch in #10 but it made the Advanced Book module so slow that it killed my MySQL server. Sat at 100% CPU for over 10 minutes. Finally killed the process, restarted MySQL, then reverted to Advanced Book Module v2.1 and is now working again. So I can't tell if the patch fixes the problem or not. But ABM 2.2 is unusable at this point, so this should be marked as a critical issue.

parasolx’s picture

have you done patch #11. patch #10 only half. you need to do both file of patching.

ransomweaver’s picture

Confirming rewrites-2 then rewrites-inc is a fix. Well done!

mike.y’s picture

Applying both patches seems to have fixed this issue for me. Thanks!

tchurch’s picture

Patch #11 worked for me too. I only needed to use the patch file advancedbookblocks-2.2-fix-rewrites-2.diff

PixelClever’s picture

Version: 6.x-2.2 » 6.x-2.3
Status: Needs review » Fixed

Committed in 2.3. I tested on my install, but if someone has a problem post it here. Thank you for posting the patch.

jzornig’s picture

2.3 is working on my site. But I now get a new issue see http://drupal.org/node/982076

Status: Fixed » Closed (fixed)

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