Page MenuHomePhabricator

(Postgres) Error: 42803 ERROR: column "temp_rev_user.revactor_actor" must appear in the GROUP BY clause or be used in an aggregate function
Closed, ResolvedPublic

Description

Jenkins failed to merge https://gerrit.wikimedia.org/r/#/c/mediawiki/core/+/588076/ because of a WikiPage query which is failing only on PostgreSQL.

Seems it was once fixed in T23196, but the query has since been rewritten because of actor table migration.

Event Timeline

daniel renamed this task from Error: 42803 ERROR: column "temp_rev_user.revactor_actor" must appear in the GROUP BY clause or be used in an aggregate function to (PostGres) Error: 42803 ERROR: column "temp_rev_user.revactor_actor" must appear in the GROUP BY clause or be used in an aggregate function.May 1 2020, 11:47 AM

The failing test is: CreditsActionTest::testOnViewOnExistingPage

Relevant part of the stack trace:
21:55:16 /workspace/src/includes/page/WikiPage.php:1208
21:55:16 /workspace/src/includes/actions/CreditsAction.php:117
21:55:16 /workspace/src/includes/actions/CreditsAction.php:69
21:55:16 /workspace/src/includes/actions/CreditsAction.php:50

Suspicious warning:
PHP Warning: Invalid argument supplied for foreach() in /workspace/src/includes/libs/rdbms/database/Database.php on line 1127

daniel triaged this task as High priority.May 1 2020, 11:52 AM
daniel added subscribers: Pchelolo, Addshore.

@Pchelolo you said a while ago you might look into putting a postgres mode into MediaWikiDockerDev. Did you get around to doing that? @Addshore, what do you think, how hard would that be? It would be very useful for debugging issues like this one...

Change 593742 had a related patch set uploaded (by Ammarpad; owner: Ammarpad):
[mediawiki/core@master] Add 'actor_id' field to GROUP BY clause, so the query can work in PostGres

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

I have added some details on the above patch commit summary

Suspicious warning:
PHP Warning: Invalid argument supplied for foreach() in /workspace/src/includes/libs/rdbms/database/Database.php on line 1127

Below the query there's a foreach function which is fed the result of the query directly. When the query fails, the value of the variable holding the query result is null and and giving foreach null will always yields that warning

Just notice this is from a different foreach from Database class.

Reedy renamed this task from (PostGres) Error: 42803 ERROR: column "temp_rev_user.revactor_actor" must appear in the GROUP BY clause or be used in an aggregate function to (Postgres) Error: 42803 ERROR: column "temp_rev_user.revactor_actor" must appear in the GROUP BY clause or be used in an aggregate function.May 1 2020, 1:59 PM
Reedy added a project: MediaWiki-General.

@Pchelolo you said a while ago you might look into putting a postgres mode into MediaWikiDockerDev. Did you get around to doing that?

I didn't manage to do the mediawiki-docker-dev one, but I have done it with docker-compose in core repo. I can test this one if needed.

@Pchelolo you said a while ago you might look into putting a postgres mode into MediaWikiDockerDev. Did you get around to doing that? @Addshore, what do you think, how hard would that be? It would be very useful for debugging issues like this one...

Should be trivial if there is a do let image for it (which I believe there is)

Hi @daniel what's the status of this task? Should I just skip Postgres in the test for patch that fixes T187518?

Umherirrender assigned this task to Ammarpad.

Change 593742 merged by jenkins-bot:
[mediawiki/core@master] Encase 'actor_id' value in aggregate function

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