On 06/11/13 16:43, Dmitry Belyavsky wrote:

select => ['DISTINCT column'] clearly should not work with DBIx::Class; and select distinct does not seems to be supported well.

distinct => 1 does something strange (group by instead of distinct), and select => [ distinct => 'column' ] MAYBE will perform as you're expecting.

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'],
      }
      );

$order_by clause is calculated separately and above.

I get an error

=======
DBIx::Class::ResultSet::next(): DBI Exception: DBD::Pg::st execute failed: ERROR: column me.distinct does not exist [Mon Jun 10 17:33:22 2013] [error] LINE 1: SELECT me.pos FROM (SELECT me.DISTINCT searchable_id, dense_rank()...
=======

For this particular query I can avoid DISTINCT, but what should I do not ot get this error?

Thank you!

--
SY, Dmitry Belyavsky


_______________________________________________
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

_______________________________________________
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