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.