
post.comments.count performs 2 queries instead of 1
Reported by Lawrence Pit | October 24th, 2008 @ 06:55 AM
When I try post.comments.count it executes two queries:
~ SELECT `id`, `created_at`, `updated_at`, `description`, `post_id`, `user_id` FROM `comments` WHERE (`post_id` IN (1)) ORDER BY `id`
~ SELECT COUNT(*) FROM `comments` WHERE (`post_id` = 1) AND (`id` IN (1,2,3,4))
=> 4
>>
It's one too many imho, and the count is a bit weird as well. I expect only this query:
SELECT COUNT(*) FROM comments WHERE post_id = 1
PS. Comment is :remixable, and Post remix n, :comments
Comments and changes to this ticket
-
Jonathan Stott (namelessjon) December 12th, 2008 @ 02:00 PM
- Assigned user changed from Sam Smoot to Dan Kubb (dkubb)
- State changed from new to confirmed
Dan, I've confirmed this (And attached a test file which demonstrates it)
Is it fixed in dkubb/dm-core ?
-
Dan Kubb (dkubb) December 12th, 2008 @ 02:47 PM
- State changed from confirmed to resolved
Yes, I can confirm that this is fixed in dkubb/dm-core after running the attached file.
However, this is also likely fixed in sam/dm-core and dm-core 0.9.8 when combined with extlib 0.9.9.
Please Sign in or create a free account to add a new ticket.
With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »