[Dbix-class] Count/pager and resultset differences when using a custom function

Peter Rabbitson rabbit+dbic at rabbit.us
Mon Apr 9 10:26:12 GMT 2012


Jan Grmela wrote:
> Hello,

Hi!

Thank you for the bugreport(s). You actually have two unrelated
problems here. I'd like your help so we can fix both:

> we use DBIx::Class 0.08196 along with Catalyst, Template Toolkit, etc
> in our web project. The underlying DB is Postgres.
> 
> Recently, we discovered a strange behavior when using complex select
> clauses with custom functions. The resultset items array is correct,
> the produced query is exactly as we wanted:
> Perl: http://pastebin.com/dLL9UNbF
> SQL: http://pastebin.com/uq7xmUhQ
> 
> However, when we try to use a pager or get the items count of this
> resultset, the query is wrong and doesn't reflect the custom function
> we're passing:
> SQL: http://pastebin.com/ph17zjjq

This is problem #1. It is an actual bug. Can you please extend this test
(the syntax should be self explanatory) to reflect your use-case:
https://github.com/dbsrgits/dbix-class/blob/master/t/count/count_rs.t#L137

> Yep, I know there are a "group_by" or "distinct => 1" params for the
> search method -- we tried that earlier and we couldn't make it work as
> we wanted because of the specifics of the Postgres SQL engine.

This is problem #2 - can you please show what you tried and what didn't
work? We would like to fix the API if it is possible to cater to your
example.

To recap - problem #1 is a real bug and will be fixed. Problem #2 may or
may not be - we need more info.

Cheers!



More information about the DBIx-Class mailing list