Conflict between Node Hierarchy and Killfile is causing SQL error when adding a new node or visiting NH configuration page.
If I disable Killfile, I don't get the error on the add node page or the NH configuration page. The SQL error shows up twice on the configuration page. I suspect this is because I have two content types currently defined. I would expect it to repeat for the number of content types in a given install.
If I disable Node Hierarchy, I don't get the error when adding a new node.
SELECT * FROM node n, nodehierarchy h
LEFT JOIN killfile_nodes kfn ON kfn.nid = n.nid
WHERE (kfn.timestamp IS NULL OR kfn.timestamp > 1228257210)
AND ( h.nid = n.nid AND h.parent = 0 AND n.type IN ('page') )
ORDER BY h.order_by ASC
Having some experience with MySQL, I am baffled as to why this query doesn't work. I tried to track down the issue by rewriting it but no luck.
It looks like the Killfile is asserting coding into the query which is found in nodehierarchy.module
/**
* Get the items for the parent selector pulldown.
*/
function _nodehierarchy_get_parent_pulldown_items( $parent_id, $types, $child_node = null, $depth = 0 ) {
$out = array();
$query = "SELECT * FROM {node} n, {nodehierarchy} h WHERE h.nid = n.nid AND h.parent = %d AND n.type IN (". implode( ",", $types ) .") ORDER BY h.order_by ASC";
$result = db_query(db_rewrite_sql($query), $parent_id);
while ($hierarchylist = db_fetch_object($result)) {
if ($hierarchylist->nid != $child_node && node_access('update', $hierarchylist)) {
$out[$hierarchylist->nid] = str_repeat('--', $depth) .' '. $hierarchylist->title;
$children = _nodehierarchy_get_parent_pulldown_items($hierarchylist->nid, $types, $child_node, $depth+1);
$out += $children;
}
}
return $out;
}
Comments
Comment #1
ronan commentedFixed in dev (both 5 and 6).
This was because MySQL 5 is much more picky about combining lazy (comma) joins and honest to goodness joins. That was causing an incompatibility with pretty much every module that uses query rewriting.
Thanks for your help.
Comment #2
capellicNo problem - just my little contribution