API: Avoid MySQL filesort with list=allpages&apfilterlanglinks=withlanglinks
I'm not sure whether r44584 didn't go far enough or if MySQL's behavior
has changed since 2008, but MySQL is now filesorting when a
constant-in-WHERE field is included in GROUP BY.
If all our supported databases used the 1999 SQL standard rules for
GROUP BY this would be an easy fix. But PostgreSQL before 9.1 uses
the older 1992 rules. And then there's Oracle and MSSQL, which aren't
listed as supported but are still in the code. Simplest thing to do
is probably to check if we're on MySQL, Sqlite, or Postgres >= 9.1 and
use the 1999 rules, and otherwise use the older rules.
: Basically "any non-aggregate field in the SELECT must be
functionally dependent on the grouped-by fields", meaning if you include the primary key you're good.
: Basically "any non-aggregate field in the SELECT must be in the