[drupal-devel] node_access_where_sql()

Jonathan Chaffer jchaffer at structureinteractive.com
Mon Feb 21 13:36:37 UTC 2005

On Feb 21, 2005, at 1:47 AM, Gerhard Killesreiter wrote:

> On Sun, 20 Feb 2005, Chris Cook wrote:
>> Most node queries use the node_access_where_sql() function like so.
>> "SELECT foo FROM bar WHERE " . node_access_where_sql() . " AND 
>> criteria = true"
>> However, the first test in the function returns nothing which will
>> obviously result in an invalid query. Shouldn't the function return a
>> value of "0" or something so that queries will always be valid?
> MAybe some docs need to be updated. We now use db_rewrite_query. See
> current code for examples.

That function used to return "1", but the node access performance patch 
changed this since db_rewrite_query doesn't need this. It was an 
accident that it breaks older modules.

The question is: do I roll a patch to revert this behavior (so older 
modules would work, but be using a deprecated and slower API), or do we 
just document it as a necessary 4.5 -> 4.6 module change?

More information about the drupal-devel mailing list