#396388 by andypost: Fix syntax of comment order query for pgsql.

merge-requests/26/head
Angie Byron 2009-08-04 06:53:48 +00:00
parent bc37b6dc0e
commit 4bfbde89e7
1 changed files with 2 additions and 2 deletions

View File

@ -423,11 +423,11 @@ function comment_new_page_count($num_comments, $new_replies, $node) {
else {
// Threaded comments.
// Find the first thread with a new comment.
$result = db_query_range('(SELECT thread
$result = db_query_range('SELECT thread FROM (SELECT thread
FROM {comment}
WHERE nid = :nid
AND status = 0
ORDER BY timestamp DESC)
ORDER BY timestamp DESC) AS thread
ORDER BY SUBSTRING(thread, 1, (LENGTH(thread) - 1))', array(':nid' => $node->nid), 0, $new_replies)->fetchField();
$thread = substr($result, 0, -1);
$count = db_query('SELECT COUNT(*) FROM {comment} WHERE nid = :nid AND status = 0 AND SUBSTRING(thread, 1, (LENGTH(thread) - 1)) < :thread', array(