[Dbix-class] select and DISTINCT

Peter Rabbitson rabbit+dbic at rabbit.us
Tue Jun 11 21:15:46 GMT 2013

On Tue, Jun 11, 2013 at 04:43:04PM +0400, Dmitry Belyavsky wrote:
> Greetings!
> After upgrading the DBIx::Class package from 8.0127 to 8.0196 the problem
> occurs in using
> select attribute of a ResultSet with DISTINCT qualifier.
> I used the syntax
>   my $rs_2 = $rs->search({},
>       {
>       select => ['DISTINCT searchable_id', "dense_rank() OVER (ORDER BY
> $order_by) AS pos" ],
>       as     => ['searchable_id', 'pos'],
>       }
>       );

This worked before by accident: you are asking DBIC to look for a column 
named (literally) q{DISTINCT searchable_id}. It only worked because you 
didn't ask DBIC to quote your identifiers. In newer versions of DBIC 
various arguments are interrogated more closely, and everything 
understandably fails.

All you want to do is say \'DISTINCT searchable_id'


More information about the DBIx-Class mailing list