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.

Comments

damien tournoud’s picture

Status: Patch (to be ported) » Closed (duplicate)