https://bugzilla.wikimedia.org/show_bug.cgi?id=26273

           Summary: Database layer should automagically add GROUP BY
                    columns on backends that need them (postgres)
           Product: MediaWiki
           Version: 1.17-svn
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: Normal
         Component: Database
        AssignedTo: wikibugs-l@lists.wikimedia.org
        ReportedBy: roan.katt...@gmail.com


Postgres is pedantic when it comes to GROUP BY queries and demands that all
selected columns that aren't used with an aggregate function be in the GROUP BY
clause, even if the GROUP BY already covers a unique index (meaning grouping by
more columns would have no effect).

MySQL is more flexible, causing developers to write queries that fail on
Postgres for this reason. Instead of developers having to go through a lot of
trouble to construct GROUP BY clauses with the right columns with the ORDER BY
columns at the beginning (r68100), the database layer should do this for them.

Because the semantics of GROUP BY described here are actually in the SQL
standard IIRC, there's likely to be more DB backends, so I think this should be
implemented in DatabaseBase::makeSelectOptions() with DB backends needing this
functionality overriding needsAllColumnsInGroupBy() or whatever to return true.

-- 
Configure bugmail: https://bugzilla.wikimedia.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
You are on the CC list for the bug.

_______________________________________________
Wikibugs-l mailing list
Wikibugs-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l

Reply via email to