Page MenuHomePhabricator

ApprovedRevs: special page's orderBy clause orders by fields not in the select
Open, Needs TriagePublic


This results in the following error when visiting the page:

Original exception: [ce6344b7fb59f5b775e1ea28] /wiki/Special:ApprovedRevs Wikimedia\Rdbms\DBQueryError from line 1603 of .../includes/libs/rdbms/database/Database.php: A database query error has occurred. Did you forget to run your application's database schema updater after upgrading?

Query: SELECT DISTINCT p.page_id AS id,ar.rev_id AS rev_id,p.page_latest AS latest_id FROM `wiki1approved_revs` `ar` JOIN `wiki1page` `p` ON ((ar.page_id=p.page_id)) LEFT OUTER JOIN `wiki1page_props` `pp` ON ((ar.page_id=pp_page)) WHERE (p.page_latest != ar.rev_id AND ( ( pp_propname = 'approvedrevs' AND pp_value = 'y' OR pp_propname = 'approvedrevs-approver-users' OR pp_propname = 'approvedrevs-approver-groups' ) )) ORDER BY p.page_namespace,p.page_title LIMIT 51

Function: SpecialApprovedRevs::reallyDoQuery

Error: 3065 Expression #1 of ORDER BY clause is not in SELECT list, references column 'wiki_d.p.page_namespace' which is not in SELECT list; this is incompatible with DISTINCT (

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald TranscriptApr 27 2020, 5:43 PM

Change 592717 had a related patch set uploaded (by markahershberger; owner: markahershberger):
[mediawiki/extensions/ApprovedRevs@master] Add missing fields for Special page's order by

That's very interesting. I can see how this would lead to a DB error, and yet on my wiki (MW 1.33) it doesn't - I think because the 'DISTINCT' option that's passed in seems to be getting ignored. So this might be two problems in one. What version of MediaWiki are you running, and what DB system?

I'm using Percona XtraDB Cluster 5.7.23-23-57-log which uses the MySQL 5.7 engine. There are a number of SO questions about this difference in MySQL 5.7, many of which say to disable ONLY_FULL_GROUP_BY but this Percona blog post explains how to actually address the problem.