Page MenuHomePhabricator

Running update.php on a fresh MediaWiki 1.30 install fails when using postgres
Closed, ResolvedPublic

Description

From @Anomie on https://gerrit.wikimedia.org/r/#/c/378261/:

update.php fails on a fresh install without this patch, with a DBQueryError exception for the error "42710 ERROR: enum label "3D" already exists". I don't know if the installer runs update.php or not.
update.php works fine on wikis created prior to Id6bfe8d2, as in that case the update is needed and runs successfully, and then the updater remembers that it has done that patch (in the updatelog table) and doesn't repeat it on subsequent runs.

Event Timeline

Change 378261 had a related patch set uploaded (by Legoktm; owner: Anomie):
[mediawiki/core@master] Add "IF NOT EXISTS" to PostgreSQL patch-add-3d.sql

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

Options for fixing this include adding "IF NOT EXISTS" to the patch (but that requires PG 9.3), or manually checking the current enum definition first in the PHP code (possibly by doing SELECT 1 FROM pg_type JOIN pg_enum ON (enumtypid = pg_type.oid) WHERE typname='media_type' AND enumlabel='3D') and skipping the patch when it's not needed.

Change 378261 merged by jenkins-bot:
[mediawiki/core@master] Fix PostgreSQL patch-add-3d.sql by replacing it

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

Change 384724 had a related patch set uploaded (by Anomie; owner: Anomie):
[mediawiki/core@REL1_30] Fix PostgreSQL patch-add-3d.sql by replacing it

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

Change 384724 merged by jenkins-bot:
[mediawiki/core@REL1_30] Fix PostgreSQL patch-add-3d.sql by replacing it

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

Anomie claimed this task.

Fixed and backported to 1.30.