
aggregate function count broken for queries with :limit
Reported by Ming | February 24th, 2010 @ 02:34 PM | in 1.1.1
This is related to the problem and fix posted over a year
ago:
http://groups.google.com/group/datamapper/browse_thread/thread/503cfb37c9ca23e5/3031713f309910b1?lnk=gst&q=size+count#3031713f309910b1
dkubb commented out the optimization of size calling
count
http://github.com/datamapper/dm-more/commit/35ac591458ba477c875b3541f0b419a2c06f00e7
to use Array#size to properly recognize :limit in the query.
If size recognizes :limit in the query, shouldn't count also?
For instance, dm-pager assumes this of count and breaks on queries with :limit:
http://github.com/visionmedia/dm-pagination/blob/master/lib/dm-pager/pagination.rb
options.merge! :total => count(query), :page => page
(The root cause is probably do_mysql adapter not translating the query correctly.)
Comments and changes to this ticket
-
Martin Gamsjaeger (snusnu) October 29th, 2010 @ 04:52 PM
- State changed from new to confirmed
- Milestone set to 1.1
- Milestone order changed from 0 to 0
-
-
Dan Kubb (dkubb) October 31st, 2010 @ 09:55 AM
(from [1f9b8bf0d97a2458b9721e5fa02a7f1f69fdcdf3]) Add failing spec for #count called on a limited collection
[#1334 state:confirmed] [#1203 state:confirmed] [#1416 state:confirmed] http://github.com/datamapper/dm-aggregates/commit/1f9b8bf0d97a2458b...
-
Dan Kubb (dkubb) October 31st, 2010 @ 10:16 AM
(from [0b2afc96e4917e868853f3c9ddcc5c8f31ba58e5]) Mark #count on a limited collection spec as pending
[#1334 state:confirmed] [#1203 state:confirmed] [#1416 state:confirmed] http://github.com/datamapper/dm-aggregates/commit/0b2afc96e4917e868...
-
Dan Kubb (dkubb) March 16th, 2011 @ 10:41 PM
- Milestone changed from 1.1 to 1.1.1
- Milestone order changed from 7 to 0
-
Piotr Solnica (solnic) May 17th, 2011 @ 02:16 AM
- Tag changed from dm-aggregate count to dm-aggregates
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 »
People watching this ticket
Tags
Referenced by
-
1416 find_by_sql in dm-ar-finders interacts badly with dm-aggregates count This is a duplicate of #1203
-
1416 find_by_sql in dm-ar-finders interacts badly with dm-aggregates count [#1334 state:confirmed] [#1203 state:confirmed] [#1416 st...
-
1203 aggregate function count broken for queries with :limit [#1334 state:confirmed] [#1203 state:confirmed] [#1416 st...
-
1334 incorrect sql for limit + count (DM 1.0) [#1334 state:confirmed] [#1203 state:confirmed] [#1416 st...
-
1416 find_by_sql in dm-ar-finders interacts badly with dm-aggregates count [#1334 state:confirmed] [#1203 state:confirmed] [#1416 st...
-
1334 incorrect sql for limit + count (DM 1.0) [#1334 state:confirmed] [#1203 state:confirmed] [#1416 st...
-
1203 aggregate function count broken for queries with :limit [#1334 state:confirmed] [#1203 state:confirmed] [#1416 st...