#9635 closed defect (bug) (fixed)
Comments Query Needs Filters
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | 2.8 | Priority: | normal |
Severity: | normal | Version: | 2.8 |
Component: | Comments | Keywords: | comments-query has-patch tested commit dev-feedback |
Focuses: | Cc: |
Description
Problem:
The comments query lacks order by and limit filters for its query, and it has a group by filter for only one of the two queries.
Example:
So, for example, if you wanted to select comments at random or some other means, you can't.
Solution:
Patch gives both comments queries the same 5 filters: join, where, groupby, orderby, limits.
Attachments (2)
Change History (14)
#2
follow-up:
↓ 3
@
16 years ago
the groupby in the singular query isn't initialized properly though.
#3
in reply to:
↑ 2
@
16 years ago
Replying to Denis-de-Bernardy:
the groupby in the singular query isn't initialized properly though.
Why do you say that? If you mean that there's no default "GROUP BY" statement prepending it, that's the behavior of the current, non-singular filter. So users of the 'comment_feed_groupby' filter already must determine whether to prepend that.
#4
follow-up:
↓ 5
@
16 years ago
dunno I haven't actually tested the patch. but while scanning the patched file, I ended up wondering if the group by statement may end up containing junk that would mess the query up. testing would reveal if it does. it might not be very useful on the singular query, too.
#5
in reply to:
↑ 4
@
16 years ago
Replying to Denis-de-Bernardy:
dunno I haven't actually tested the patch. but while scanning the patched file, I ended up wondering if the group by statement may end up containing junk that would mess the query up. testing would reveal if it does.
I updated the patch to pass a blank string to the filter.
Replying to Denis-de-Bernardy:
it might not be very useful on the singular query, too.
Well, I can think of a couple of situations in which I could use a GROUP BY querying comments on a singular object, but that doesn't really matter for the purposes of this ticket. What matters is that this filter already exists for the other, non-singular comments query, so for consistency's sake it should be available with the singular one.
#6
@
16 years ago
- Keywords tested commit dev-feedback added
current patch is harmless.
adding dev-feedback keyword on one point, which is the group by.
in the posts query, group by is assumed to not contain any GROUP BY clause, i.e. if non-empty groupby then groupby = GROUP BY groupby.
whereas in the comments query, it's assumed to contain the GROUP BY clause. it's not much of a big deal, but at the risk of breaking a plugin or two we might want those two to be kept consistent.
#7
@
16 years ago
I've added a patch that makes the comments query order by and group by filters consistent with those of the main query.
patch applies cleanly against today's trunk