Nilson Santos Figueiredo Jr. wrote:
> So, it seems like I'm always prone to this kind of stuff.
> Well, anyway, today I moved some code from a server with DBIC 0.08107
> to a new server, with the latest DBIC 0.08112 and some joins stopped
> working.
>
> Specifically, this query doesn't produce the desired results anymore:
>
> my $rs = $schema->resultset('FilingPDF')->search(
> { 'me.file_path' => undef, processing => '0', ticker => { '!=', undef }
> },
> {
> prefetch => { filing => 'company' },
> join => { filing => { company => 'tickers' } },
> group_by => 'me.id'
> },
> );
>
Before going further qualify your joined column names. A very complex dance
takes place to make sure the correct joins are brought in, and unqualified
column names upset it. It was deemed a reasonable compromise, as if the
joins are wrongly omitted, the query will fail, instead of returning incorrect
results.
As to why the convoluted subquery is necessary - it allows an arbitrarily
complex group_by on the main table while preserving prefetches.
Cheers
_______________________________________________
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/[email protected]