I get this ugly pink error when I visit my view URL. It only goes away if I delete the field 'Comment: Last Changed Time' from the view, but comes back when I add the field again.
user warning: Unknown column 'node_comment_statistics.last_comment_timestamp' in 'field list' query:
SELECT node.nid, relativity_parent_node.title AS relativity_parent_node_title, relativity_parent_node.nid AS relativity_parent_node_nid, node_data_field_status.field_status_value AS node_data_field_status_field_status_value, node.title AS node_title, node.changed AS node_changed, node_data_field_deadline.field_deadline_value AS node_data_field_deadline_field_deadline_value, GREATEST(node.changed, node_comment_statistics.last_comment_timestamp) AS node_comment_statistics_last_changed FROM node node LEFT JOIN relativity relativity ON node.nid = relativity.nid LEFT JOIN node relativity_parent_node ON relativity.parent_nid = relativity_parent_node.nid LEFT JOIN content_type_issue_log node_data_field_status ON node.vid = node_data_field_status.vid LEFT JOIN content_type_issue_log node_data_field_deadline ON node.vid = node_data_field_deadline.vid WHERE (node.type IN ('issue_log')) ORDER BY node in /.../includes/database.mysql.inc on line 172.
Please help - I've just had my dinner and it's making me feel queasy ;)
BTW What does 'Views Data' mean anyway?
Comments
Comment #1
JohnG-1 commentederror 2 : when Field-Sorting by column/field 'Comment: Last Changed Time' :
error message:
I cannot trace which function is creating the
node_comment_statistics.last_changedquery.conditions:
no error 'Comment: Last Changed Time' is added as a Sort Criteria
no error 'Comment: Last Changed Time' is added as a Field; Sortable->no; Default_Sort->none
no error 'Comment: Last Changed Time' is added as a Field; Sortable->no; Default_Sort->ascending
no error 'Comment: Last Changed Time' is added as a Field; Sortable->no; Default_Sort->descending
no error 'Comment: Last Changed Time' is added as a Field; Sortable->yes; Default_Sort->none
error !!! 'Comment: Last Changed Time' is added as a Field; Sortable->yes; Default_Sort->none; and then click on the view's 'sort_this_column' link.
error !!! 'Comment: Last Changed Time' is added as a Field; Sortable->yes; Default_Sort->ascending
error !!! 'Comment: Last Changed Time' is added as a Field; Sortable->yes; Default_Sort->descending
So the error appears only when I attempt to use the 'Comment: Last Changed Time' Table Field Sortable function ... and therefore the most likely candidate (based on the 'conditions' behaviour) seems to be 'views_handler_sort_last_changed' in views_comment.inc :
Neither PHP nor SQL are my strong point so not surprisingly I can't see anything wrong ... for comparison the most similar function appears to be in views.module :
interesting that 2 methods are commented out ... looks like tweaking, in which case
view_comments.inc:
$query->orderby[] = 'GREATEST(node.changed, node_comment_statistics.last_comment_timestamp) ' . $sort['sortorder'];would appear to have deprecated syntax ???could that be the problem ?
Any help most welcome - I've spent all day looking at this and all I'm sure of is that it is a genuine bug :(
Comment #2
merlinofchaos commentedThis is a bug; and it was fixed in dev. It was a side effect of the code to figure out how to sort using clicksort was using the wrong variable. However, that variable happened to *usually* be right. Just not quite always.
Comment #3
JohnG-1 commentedThanks for confirmation. I'll wait for ver 1.6 ... :)
Comment #4
(not verified) commented