Page MenuHomePhabricator

Error: 1054 Unknown column 'iw_api' in 'field list' when upgrading from <1.17 to >1.25
Open, Needs TriagePublic

Description

Upgrading from an ancient MediaWiki version (1.10) to the current version (1.33) seems to cause this error:

Creating interwiki table ...done.

Adding default interwiki definitions ...[edf831bd3c1f7c8ba0ae43f6] [no req]   Wikimedia\Rdbms\DBQueryError from line 1587 of /var/www/html/mediawiki/includes/libs/rdbms/database/Database.php: A database query error has occurred. Did you forget to run your application's database schema updater after upgrading?

Query: REPLACE INTO `interwiki` (iw_prefix,iw_url,iw_local,iw_api) VALUES

('acronym','https://www.acronymfinder.com/~/search/af.aspx?string=exact&Acronym=$1',0,''),

('advogato','http://www.advogato.org/$1',0,''),

('arxiv','https://www.arxiv.org/abs/$1',0,''),

....


('wikispecies','https://species.wikimedia.org/wiki/$1',0,'https://species.wikimedia.org/w/api.php'),

('wikiversity','https://en.wikiversity.org/wiki/$1',0,'https://en.wikiversity.org/w/api.php'),

('wikivoyage','https://en.wikivoyage.org/wiki/$1',0,'https://en.wikivoyage.org/w/api.php'),

('wikt','https://en.wiktionary.org/wiki/$1',0,'https://en.wiktionary.org/w/api.php'),

('wiktionary','https://en.wiktionary.org/wiki/$1',0,'https://en.wiktionary.org/w/api.php')

Function: Wikimedia\Rdbms\Database::sourceFile( /var/www/html/mediawiki/maintenance/interwiki.sql )

Error: 1054 Unknown column 'iw_api' in 'field list' (localhost)

Looks like the interwiki table is filled before the patch-iw_api_and_wikiid.sql is executed, causing the upgrade to fail because one of the insert columns doesn't exist (yet).

This may be happening since MediaWiki 1.25, when this column was added to the inserts: T48992: Fill the iw_api column of the interwiki table. The iw_api column was added in MediaWiki 1.17 according to the docs.

See original report in Topic:V4533p3tawophf3a

Event Timeline

Aklapper renamed this task from Error: 1054 Unknown column 'iw_api' in 'field list' when upgrading from an ancient MediaWiki to Error: 1054 Unknown column 'iw_api' in 'field list' when upgrading from <1.17 to >1.25.Jul 25 2022, 4:30 PM