Explaining this one is going to be a challenge... Here's my third attempt:

In a nutshell, note_pathauto_page is passing an extra argument to db_rewrite_sql, which gets ignored the vast majority of the time (possibly all the time the way the Drupal code is written now -- I came across it when I was patching another database-specific problem).

The second argument to db_rewrite_sql is supposed to be the node alias, but the code is passing the local $prefix variable (for auto-generated index pages). This breaks any query that uses the second parameter to db_rewrite_sql.

The solution is to simply remove $prefix from the call to db_rewrite_sql, as shown in the attached patch (made against CVS).

(You don't need to be able to reproduce the problem I'm having in order to understand the fix; just compare the code/patch to the API. However, if you want to reproduce it, you need to be using some sort of node_access module (e.g. simple_access) and be using this proposed patch, and use the auto-generated index pages in pathauto. After making sure that at least one node has access restrictions, go to an autogenerated index page, and you should get a database error.)

CommentFileSizeAuthor
pathauto_node.inc_7.patch708 bytesSteve Simms

Comments

greggles’s picture

Status: Reviewed & tested by the community » Fixed

Fixed as part of other issues. Thanks for the patch and for your detailed explanation.

Anonymous’s picture

Status: Fixed » Closed (fixed)