[Dbix-class] Bad/missing joins on generated SQL (0.08112)

Nilson Santos Figueiredo Jr. acid06 at gmail.com
Tue Sep 29 19:40:46 GMT 2009


On Tue, Sep 29, 2009 at 4:25 PM, Peter Rabbitson <rabbit+dbic at rabbit.us> wrote:
> 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.

Thanks, this fixed it.
I usually don't qualify joined column names and everything worked fine
until now - going forward I'll try to qualify everything to play it
safe going.

I agree that failing is probably better than wrong results.

> As to why the convoluted subquery is necessary - it allows an arbitrarily
> complex group_by on the main table while preserving prefetches.

Well, the new convoluted subquery actually runs twice as fast as the
old one (on MySQL).
So I'm not complaining as long as it works. ;-)

-Nilson Santos F. Jr.



More information about the DBIx-Class mailing list