[Dbix-class] [ANNOUNCE] 0.08103 RC3 - call for testers! (whops)

Peter Rabbitson rabbit+dbic at rabbit.us
Wed May 27 11:52:46 GMT 2009


Anthony Gladdish wrote:
> Hi Peter,
> 
 > Unfortunately this still fails.
> Attached is my failing test case, against DBIC 0.08103.
> 
> Again, removing "distinct => 1" from my search passes the test - but I would have expected this to work ok regardless, like it has with previous versions of DBIC.
> 
> Thanks,
> Anthony
> 

Hi

Right... except that in previous versions it _didn't_ work. Distinct is
documented since pre 0.081xx as "Set to 1 to group by all columns". Here
"all columns" means "all SELECT()ed columns", and is a requirement for
any sane database engine. The generated SQL is exactly what you asked for.

Now unfortunately MySQL chokes on it. My take on this is that instead of
DBIC producing crippled SQL to accommodate a weird engine, you simply
shouln't submit problematic queries to it. The problematic SQL[1] is
generated only by counting an $rs with prefetch+distinct and such
usage is rare-enough to warrant ugly storage driver overrides.

I do wonder however what others think.

Cheers

[1] A GROUP BY in a subquery, involving several identically named columns



More information about the DBIx-Class mailing list