[drupal-devel] node_access_where_sql()

Steven Wittens steven at acko.net
Mon Feb 21 15:23:36 UTC 2005

Jonathan Chaffer wrote:

> 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?
Actually this broke the node.module's hook_search as it calls 
_db_rewrite_sql() directly. I already patched this, but perhaps we 
should consider going back to the old behaviour.

Steven Wittens

More information about the drupal-devel mailing list