Page MenuHomePhabricator

Postgresql: non-integer constant in ORDER BY
Closed, ResolvedPublic

Description

Author: pashev.igor

Description:
ActiveUsers page does not work with Postgres (includes/specials/SpecialActiveusers.php):

Jul 07 13:15:21 xxx postgres[1234]: ERROR: non-integer constant in ORDER BY at character 361
Jul 07 13:15:21 xxx postgres[1234]: STATEMENT: SELECT rc_user_text,MAX(rc_timestamp) AS lastedittime FROM "recentchanges" WHERE (rc_user > 0) AND (rc_type != '5') AND (rc_log_type IS NULL OR rc_log_type != 'newusers') AND (rc_timestamp >= '2014-06-07 13:15:21 GMT') AND (rc_timestamp <= '2014-07-07 13:15:21 GMT') GROUP BY rc_user_text ORDER BY NULL

This bug is introduced by https://git.wikimedia.org/commit/mediawiki%2Fcore.git/87be24dbdf8235e381110393011b86e0f5be395f


Version: 1.23.1
Severity: major
OS: Linux

Details

Reference
bz67594

Related Objects

View Standalone Graph
This task is connected to more than 200 other tasks. Only direct parents and subtasks are shown here. Use View Standalone Graph to show more of the graph.
StatusSubtypeAssignedTask
InvalidNone
ResolvedJjanes

Event Timeline

bzimport raised the priority of this task from to Needs Triage.Nov 22 2014, 3:39 AM
bzimport set Reference to bz67594.

Reproduced by simply going to http://localhost/wiki/index.php/Special:ActiveUsers

The "ORDER BY NULL" optimization seems to be MySQL peculiarity.

includes/specials/SpecialActiveusers.php: 'ORDER BY' => 'NULL' // avoid filesort

I can hack includes/db/DatabasePostgres.php selectSQLText to specifically delete that clause, but that is the correct to approach the problem?

Doing so doesn't make Special:ActiveUsers work again under PostgreSQL, but it does get further before hitting a different error.

Change 144824 had a related patch set uploaded by Jjanes:
PostgreSQL: Fix ORDER BY NULL

https://gerrit.wikimedia.org/r/144824

Kevin,

Yes, https://gerrit.wikimedia.org/r/#/c/144765/ fixes this bug in 1.24. I put the wrong bug number into the commit message, but since it got merged already I have no idea how to fix it now. The mediawiki.org pages for gerrit don't seem to cover the situation of amending a commit messge that has already been merged.

Fixed by https://gerrit.wikimedia.org/r/#/c/144765/ ; closing as FIXED.

Should there be a request to backport to 1.23.x tarballs? If so, feel free to set the backport flag in this ticket.

Gerrit change 144824 is the backport to REL1_23, so I'm setting the appropriate flag

Change 144824 merged by jenkins-bot:
PostgreSQL: Fix ORDER BY NULL

https://gerrit.wikimedia.org/r/144824

Jdforrester-WMF subscribed.

Migrating from the old tracking task to a tag for PostgreSQL-related tasks.