Skip Menu |

This queue is for tickets about the DBIx-Class CPAN distribution.

Report information
The Basics
Id: 73244
Status: resolved
Priority: 0/
Queue: DBIx-Class

People
Owner: Nobody in particular
Requestors: madcityzen [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 0.08196
Fixed in: 0.08200



Subject: group_by with rows for RowCountOrGenericSubQ limit types loses group_by
I have an ASE server with log entries. I'm running a query that will give me the top 5 users in a given time period. my $rs = $schema->resultset('Log')->search({},{rows => 5, group_by=>[qw/userId/]}) diag $rs->as_query; # \[ # '(SET ROWCOUNT 5 # SELECT [me].[date], [me].[userId], [me].[itemId], [me].[serverId], [me].[fileId], [me].[appId], [me].[queries] FROM [usage] [me] # SET ROWCOUNT 0 # )' # ] But if I remove the rows=>5, I get the group by. my $rs = $schema->resultset('Log')->search({},{group_by=>[qw/userId/]}); diag $rs->as_query; # \[ # '(SELECT [me].[date], [me].[userId], [me].[relationId], [me].[serverId], [me].[fileId], [me].[appId], [me].[queries] FROM [mim_usage] [me] GROUP BY [userId])' # ] Tracing through SQLA and SQLMaker, I could not find the place where Group By was added, but if there's any other information I can provide, let me know.
On Tue Dec 13 17:18:21 2011, madcityzen@gmail.com wrote: Show quoted text
> I have an ASE server with log entries. I'm running a query that will > give me the top 5 users in a given time period. > > my $rs = $schema->resultset('Log')->search({},{rows => 5, > group_by=>[qw/userId/]}) > > diag $rs->as_query; > # \[ > # '(SET ROWCOUNT 5 > # SELECT [me].[date], [me].[userId], [me].[itemId], [me].[serverId], > [me].[fileId], [me].[appId], [me].[queries] FROM [usage] [me] > # SET ROWCOUNT 0 > # )' > # ] > > But if I remove the rows=>5, I get the group by. > > my $rs = $schema->resultset('Log')->search({},{group_by=>[qw/userId/]}); > diag $rs->as_query; > # \[ > # '(SELECT [me].[date], [me].[userId], [me].[relationId], > [me].[serverId], [me].[fileId], [me].[appId], [me].[queries] FROM > [mim_usage] [me] GROUP BY [userId])' > # ] > > Tracing through SQLA and SQLMaker, I could not find the place where > Group By was added, but if there's any other information I can provide, > let me know.
Confirmed, stupid mistake. Will be fixed in DBIC 0.08197.
This has finally been fixed in master by git.shadowcat.co.uk/gitweb/gitweb.cgi?p=dbsrgits/DBIx-Class.git;a=commitdiff;h=d3cd93b9 Cheers
Fixed in 0.08200, sorry for the delay.