Page MenuHomePhabricator

installer: PostgresUpdater fails on update to 1.37
Closed, ResolvedPublicBUG REPORT

Description

List of steps to reproduce (step by step, including full links if applicable):

Try upgrading a PostgreSQL-based MediaWiki installation to 1.37.0:
php update.php

What happens?:

Update script fails with

could not create unique index "wl_user_namespace_title"
DETAIL:  Key (wl_namespace, wl_title, wl_user)=(0, string omitted, number omitted) is duplicated.

Function: PostgresUpdater::changeField
Query: ALTER TABLE watchlist ALTER wl_namespace TYPE INT USING 0

The Patch for T286779 is missing in 1.37

column "user_token" of relation "user" contains null values

In our installation the is an Anonymous user without token. I removed this user. Is this correct?

Function: PostgresUpdater::changeField
Query: ALTER TABLE "revision" ALTER rev_comment_id TYPE BIGINT USING
			[ 'changeField', 'revision', 'rev_comment_id', 'BIGINT', 'DEFAULT 0' ],
			[ 'changeField', 'revision', 'rev_actor', 'BIGINT', 'DEFAULT 0' ],

This causes the error. DEFAULT 0 is not used before.
A Patch for changeField will be:

				if ( strlen( $default ) ) {
					$sql .= " USING $default";
				}

Patch will be submitted.

What should have happened instead?:
Script should have finished execution without errors.

Software version (if not a Wikimedia wiki), browser information, screenshots, other information, etc:
MediaWiki 1.36.1 → 1.37.0 (basic schema upgrade).

The PostgresUpdater is not automatically tested?

Event Timeline

Hi @Willertr, thanks for taking the time to report this! This sounds like a duplicate of T286779, if I understand correctly?

No. This Bug T286779 is not fixed in 1.37. Only in 1.36.
And new Bugs added to PostgresUpdater.
My new Commit has the wrong (old) Bug number.

Change 744866 had a related patch set uploaded (by Ladsgroup; author: Amir Sarabadani):

[mediawiki/core@master] installer: Fix Postgres mistakes in using changeField method

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

Change 745382 had a related patch set uploaded (by Reedy; author: Amir Sarabadani):

[mediawiki/core@REL1_36] installer: Fix Postgres mistakes in using changeField method

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

Change 744866 merged by jenkins-bot:

[mediawiki/core@master] installer: Fix Postgres mistakes in using changeField method

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

Change 745382 merged by jenkins-bot:

[mediawiki/core@REL1_36] installer: Fix Postgres mistakes in using changeField method

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

Change 745381 merged by jenkins-bot:

[mediawiki/core@REL1_37] installer: Fix Postgres mistakes in using changeField method

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

Umherirrender assigned this task to Reedy.
Umherirrender removed a project: Patch-For-Review.

Change 872984 had a related patch set uploaded (by Func; author: Func):

[mediawiki/core@master] PostgresUpdater: Move setDefault ahead of changeNullableField

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

Change 872984 merged by jenkins-bot:

[mediawiki/core@master] PostgresUpdater: Move setDefault ahead of changeNullableField

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

Change 873748 had a related patch set uploaded (by Func; author: Func):

[mediawiki/core@REL1_39] PostgresUpdater: Move setDefault ahead of changeNullableField

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

Change 873749 had a related patch set uploaded (by Func; author: Func):

[mediawiki/core@REL1_38] PostgresUpdater: Move setDefault ahead of changeNullableField

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

Change 873748 merged by jenkins-bot:

[mediawiki/core@REL1_39] PostgresUpdater: Move setDefault ahead of changeNullableField

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

Change 873749 merged by jenkins-bot:

[mediawiki/core@REL1_38] PostgresUpdater: Move setDefault ahead of changeNullableField

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