Closed (duplicate)
Project:
Drupal core
Version:
6.x-dev
Component:
comment.module
Priority:
Normal
Category:
Task
Assigned:
Reporter:
Created:
11 Sep 2006 at 15:23 UTC
Updated:
11 Dec 2006 at 10:21 UTC
There is a random, uneccessary "GROUP BY" clause added to the original comment query. But, there are no aggregation functions (COUNT,MAX,MIN,etc.) on the main query. Removes and fixes a couple quries that do that. Below is an example of the problematic query. Notice the GROUP BY added at the end.
$query = 'SELECT c.cid, c.pid, c.nid, c.subject, c.comment, c.format, c.timestamp, c.name, c.mail, c.homepage, u.uid, u.name AS registered_name, u.picture, u.data, c.score, c.users, c.status FROM {comments} c INNER JOIN {users} u ON c.uid = u.uid WHERE c.cid = %d';
$query_args = array($cid);
if (!user_access('administer comments')) {
$query .= ' AND c.status = %d';
$query_args[] = COMMENT_PUBLISHED;
}
$query .= ' GROUP BY c.cid, c.pid, c.nid, c.subject, c.comment, c.format, c.timestamp, c.name, c.mail, u.picture, c.homepage, u.uid, u.name, u.picture, u.data, c.score, c.users, c.status';
| Comment | File | Size | Author |
|---|---|---|---|
| comment_sql_clean_up.patch | 1.15 KB | Souvent22 |
Comments
Comment #1
Souvent22 commentedComment #2
chx commentedComment #3
ChrisKennedy commentedWell, so much for this one. Duplicated at http://drupal.org/node/102151 and fixed within 3 hours. Good work finding the bug 3 months earlier though.