Skip Menu |
 

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

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

People
Owner: Nobody in particular
Requestors: andre [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 0.08206
Fixed in: 0.08208



Subject: Duplicated columns with 'having'
Download (untitled) / with headers
text/plain 965b
Hello, I have also mentioned this issue on IRC and on the mailing list, but I've been told to also report it here. I have run into a bug when using an aggregate function and setting two or more possible values to the same column in the 'having' clause. Example: my $rs = $schema->resultset("Artist")->search( {}, { join => 'cds', group_by => 'me.artistid', '+select' => [ { max => 'cds.year', -as => 'newest_cd_year' } ], '+as' => ['newest_cd_year'], having => { 'newest_cd_year' => [ '1998', '2001' ] } } ); As the 'newest_cd_year' has two possible values (1998 and 2001), count() will add "MAX(cds.year) AS newest_cd_year" twice to the 'select' attribute. This happens only with count(). $rs->all, for example, would generate the query correctly. I have submitted a patch in the branch 'topic/duplicate_columns_having_count'. Would somebody review the code and merge it to master, please?
Download (untitled) / with headers
text/plain 229b
Excellent diagnostics, fix and execution (tested, documented, etc). Patches like this rekindle my faith in sane developers ;) Merged to master with minimal changes (renamed couple variables, referencing this RT in the changelog)
On CPAN as of 0.08208. Thank you for your help!


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.