Closed (won't fix)
Project:
Node Order
Version:
5.x-1.2
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
9 Jun 2012 at 20:35 UTC
Updated:
10 Jul 2014 at 03:22 UTC
Jump to comment: Most recent
Hello,
when I have installed module on PostgreSQL, I was unable to see pages like /nodeorder/term/15. This was because of error produced by taxonomy_select_nodes:
pg_query() [function.pg-query]: Query failed: ERROR: for SELECT DISTINCT, ORDER BY expressions must appear in select list in /usr/share/drupal/includes/database.pgsql.inc on line 126.
I had to do these changes in nodeorder.module:
--- nodeorder.orig/nodeorder.module 2007-06-16 00:47:16.000000000 +0200
+++ nodeorder/nodeorder.module 2012-06-09 22:29:10.000000000 +0200
@@ -162,10 +162,10 @@
//
// First sort by sticky, then by weight_in_tid...
if ($operator == 'or') {
- $order = 'n.sticky DESC, tn.weight_in_tid';
+ $order = 'n.sticky DESC, tn.weight_in_tid DESC';
}
else {
- $order = 'n.sticky DESC, tn0.weight_in_tid';
+ $order = 'n.sticky DESC, tn0.weight_in_tid DESC';
}
switch ($op) {
@@ -186,7 +186,7 @@
}
}
- $output .= taxonomy_render_nodes(taxonomy_select_nodes($tids, $operator, $depth, TRUE, $order));
+ $output .= taxonomy_render_nodes(nodeorder_select_nodes($tids, $operator, $depth, TRUE, $order));
$output .= theme('feed_icon', url('taxonomy/term/'. $str_tids .'/'. $depth .'/feed'));
return $output;
break;
@@ -253,17 +253,19 @@
if ($operator == 'or') {
$str_tids = implode(',', call_user_func_array('array_merge', $descendant_tids));
- $sql = 'SELECT DISTINCT(n.nid), n.sticky, n.title, n.created FROM {node} n INNER JOIN {term_node} tn ON n.nid = tn.nid WHERE tn.tid IN ('. $str_tids .') AND n.status = 1 ORDER BY '. $order;
+ $sql = 'SELECT DISTINCT(n.nid), n.sticky, n.title, n.created, tn.weight_in_tid FROM {node} n INNER JOIN {term_node} tn ON n.nid = tn.nid WHERE tn.tid IN ('. $str_tids .') AND n.status = 1 ORDER BY '. $order;
$sql_count = 'SELECT COUNT(DISTINCT(n.nid)) FROM {node} n INNER JOIN {term_node} tn ON n.nid = tn.nid WHERE tn.tid IN ('. $str_tids .') AND n.status = 1';
}
else {
$joins = '';
$wheres = '';
+ $selects = '';
foreach ($descendant_tids as $index => $tids) {
$joins .= ' INNER JOIN {term_node} tn'. $index .' ON n.nid = tn'. $index .'.nid';
$wheres .= ' AND tn'. $index .'.tid IN ('. implode(',', $tids) .')';
+ $selects .= ' , tn'. $index .'.weight_in_tid';
}
- $sql = 'SELECT DISTINCT(n.nid), n.sticky, n.title, n.created FROM {node} n '. $joins .' WHERE n.status = 1 '. $wheres .' ORDER BY '. $order;
+ $sql = 'SELECT DISTINCT(n.nid), n.sticky, n.title, n.created '. $selects .' FROM {node} n '. $joins .' WHERE n.status = 1 '. $wheres .' ORDER BY '. $order;
$sql_count = 'SELECT COUNT(DISTINCT(n.nid)) FROM {node} n '. $joins .' WHERE n.status = 1 '. $wheres;
}
$sql = db_rewrite_sql($sql);
@@ -502,7 +504,6 @@
// Note that it would be nice to wrap this in a transaction...
// We rely on the fact that every node has a unique weight_in_tid
- // (initially equal to negative one times its nid)...
$weight = db_result(db_query("SELECT weight_in_tid FROM {term_node} WHERE nid = %d AND tid = %d", $node->nid, $tid));
if ($up) {Mostly it is about enhancing local copy of nodeorder_select_nodes to include tn.weight_in_tid in the select list. I have also removed comment which says weight_in_tid have negative numbers.
I'm not sure about all this here, but now it works for me.
Comments
Comment #1
dieuwePossible duplicate: #1624844: Installation on PostgreSQL.
Closing as 5.x is no longer supported.