Hello,

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?

Thank you,
André


_______________________________________________
List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
Searchable Archive: http://www.grokbase.com/group/dbix-class@lists.scsys.co.uk

Reply via email to