Posted by Jurrien Stutterheim (norm2782) on 2008-09-18T06:29:52.000+0000
The query described in the blogpost will generate a query similar to this one:
SELECT count(c.id) AS "total_comments", count(v.id) AS "total_votes" FROM "comments" AS "c" LEFT JOIN "votes" AS "v" ON delas.id = v.deal_id GROUP BY "foo"."id"
As far as I can see there is no sane reason for anyone to paginate this kind of query: it will always return one row with two columns (total_comments and total_votes). So, the result described in the blog post as being wrong is actually correct.
I'm curious to see if the bug the author describes is present in normal JOIN queries (that is, queries without COUNTs as columns). Without feedback, this bug won't get any attention and it will be closed as Not An Issue.
Posted by Jurrien Stutterheim (norm2782) on 2008-09-19T14:29:12.000+0000
Correction of query in last comment:
SELECT "deals".*, count(c.id) AS "total_comments", count(v.id) AS "total_votes" FROM "deals"
LEFT JOIN "comments" AS "c" ON deals.id = c.deal_id
LEFT JOIN "votes" AS "v" ON deals.id = v.deal_id GROUP BY "deals"."id"
I'm still not sure if this would actually cause a problem... the adapter the blog post describes is old and there have been quite a lot of updates since then...
Comments
Posted by Jurrien Stutterheim (norm2782) on 2008-09-18T06:29:52.000+0000
The query described in the blogpost will generate a query similar to this one:
As far as I can see there is no sane reason for anyone to paginate this kind of query: it will always return one row with two columns (total_comments and total_votes). So, the result described in the blog post as being wrong is actually correct. I'm curious to see if the bug the author describes is present in normal JOIN queries (that is, queries without COUNTs as columns). Without feedback, this bug won't get any attention and it will be closed as Not An Issue.
Posted by Jurrien Stutterheim (norm2782) on 2008-09-19T14:29:12.000+0000
Correction of query in last comment:
I'm still not sure if this would actually cause a problem... the adapter the blog post describes is old and there have been quite a lot of updates since then...