Page MenuHomePhabricator

PostgreSQL upgrade fails at patch-pagelinks-target_id.sql
Closed, ResolvedPublicBUG REPORT

Description

Steps to replicate the issue (include links if applicable):

  • Install MediaWiki 1.40 or earlier on PostgreSQL
  • Run maintenance/update.php

What happens?:

Adding pl_target_id field to table pagelinks...Wikimedia\Rdbms\DBQueryError from line 1237 of /srv/mw/core/includes/libs/rdbms/database/Database.php: Error 42601: ERROR:  syntax error at or near "UNSIGNED"
LINE 2:  ADD  pl_target_id BIGINT UNSIGNED DEFAULT NULL
                                  ^

Function: Wikimedia\Rdbms\Database::sourceFile( /srv/mw/core/maintenance/archives/patch-pagelinks-target_id.sql )
Query: ALTER TABLE  "pagelinks"
 ADD  pl_target_id BIGINT UNSIGNED DEFAULT NULL

What should have happened instead?:

It should have sourced the PostgreSQL schema patch file, but it has an incorrect path:

$ find -name patch-pagelinks-target_id.sql
./maintenance/archives/patch-pagelinks-target_id.sql
./maintenance/postgres/archives/postgres/patch-pagelinks-target_id.sql
./maintenance/sqlite/archives/sqlite/patch-pagelinks-target_id.sql

postgres (or sqlite) should not appear in the path twice. So the file_exists() in DatabaseUpdater::patchPath() fails and it tries to run the MySQL version of the patch.

Event Timeline

Change 975876 had a related patch set uploaded (by Umherirrender; author: Umherirrender):

[mediawiki/core@master] installer: Fix location of patch-pagelinks-target_id.sql for postgres

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

Change 975888 had a related patch set uploaded (by Ladsgroup; author: Umherirrender):

[mediawiki/core@REL1_41] installer: Fix location of patch-pagelinks-target_id.sql for postgres

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

Change 975888 merged by jenkins-bot:

[mediawiki/core@REL1_41] installer: Fix location of patch-pagelinks-target_id.sql for postgres

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

Change 975876 merged by jenkins-bot:

[mediawiki/core@master] installer: Fix location of patch-pagelinks-target_id.sql for postgres

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

There is an identical problem with SQLite.

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

[mediawiki/core@master] sqlite: Fix pagelinks schema patch

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

There is an identical problem with SQLite.

My bad. I thought we had tests for that.

Change 978057 merged by jenkins-bot:

[mediawiki/core@master] sqlite: Fix pagelinks schema patch

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

Change 978066 had a related patch set uploaded (by Umherirrender; author: Amir Sarabadani):

[mediawiki/core@REL1_41] sqlite: Fix pagelinks schema patch

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

Change 978066 merged by jenkins-bot:

[mediawiki/core@REL1_41] sqlite: Fix pagelinks schema patch

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