[drupal-devel] Logic in node.module's node_db_rewrite_sql function
Hi all, I'm trying to follow through the circumstances under which a DISTINCT gets added into a query. e.g. at the moment If I request a Drupal path such as "taxonomy_menu/3" then I get duplicate entries for any nodes that are assigned to more than one term in that vocabulary. Looking at node.module it only sets distinct if !node_access_view_all_nodes() which seems to be an access permissions related condition. Should I be putting a hook in one of my own modules to control this? tvm, -Michael
Looking at node.module it only sets distinct if !node_access_view_all_nodes() which seems to be an access permissions related condition.
http://drupaldocs.org/api/head/function/hook_db_rewrite_sql Any module can implement this hook and if the returned associate array contains 'distinct' => 1 then DISTINCT will fire. node module implementation of this: if the 'grant all' is not in place, then there should be a node grant module in use, so let's fire a DISTINCT.
participants (2)
-
Karoly Negyesi -
Michael Josephson