Closed (duplicate)
Project:
Drupal core
Version:
6.12
Component:
comment.module
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
14 May 2009 at 06:35 UTC
Updated:
14 May 2009 at 07:25 UTC
comment.module contains at leas incorrect SQL queries:
result = db_query('(SELECT thread FROM {comments} WHERE nid = %d AND status = 0 ORDER BY timestamp DESC LIMIT %d) ORDER BY thread DESC LIMIT 1', $nod e->nid, $new_replies);
SQL-aware database (i.e. Pgsql) does not support multiple ORDER BY clauses, so this query should be rewritten as
$result = db_query('SELECT thread FROM (SELECT thread FROM {comments} WHERE nid = %d AND status = 0 ORDER BY timestamp DESC LIMIT %d) AS thread ORDER BY thread DESC LIMIT 1', $node->nid, $new_replies);
I'm not MySQL user, so cannot check this change under MySQL. It is possible, that queries should differ on MySQL and PgSQL
Patch attached.
| Comment | File | Size | Author |
|---|---|---|---|
| drupal-comment-module-order-by.diff | 1.68 KB | Alex_Tutubalin |
Comments
Comment #1
damien tournoud commentedThis is a duplicate of #396388: Fix syntax of comment ordering subquery.