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 _______________________________________________ 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]
