Hi,
I tried to upgrade a Mediawiki 1.37.2 instance to 1.38.2 (the latest stable).
When I ran the php update.php update routine, the update failed with an SQL exception during the OATHAuth extension's SQL updates.
Steps to replicate the issue (include links if applicable):
- Install Mediawiki 1.37.2 with PostgreSQL (I use v13.7 on Debian 11 'Bullseye')
- Upgrade it to Mediawiki 1.38.2
- Run the update.php routine
What happens?:
...oathauth_users table already exists. Modifying table oathauth_users...done. Modifying id field of table oathauth_users...Wikimedia\Rdbms\DBQueryError from line 1606 of /srv/mediawiki/mediawiki-1.38.2/w/includes/libs/rdbms/database/Database.php: Error 42601: ERROR: syntax error at or near "CHANGE" LINE 1: ...rs-drop-id-nextval.sql ) */ TABLE oathauth_users CHANGE id ... ^ Function: Wikimedia\Rdbms\Database::sourceFile( /srv/mediawiki/mediawiki-1.38.2/w/extensions/OATHAuth/sql/postgres/patch-oathauth_users-drop-id-nextval.sql ) Query: ALTER TABLE oathauth_users CHANGE id id INT NOT NULL #0 /srv/mediawiki/mediawiki-1.38.2/w/includes/libs/rdbms/database/Database.php(1590): Wikimedia\Rdbms\Database->getQueryException('ERROR: syntax ...', 42601, 'ALTER TABLE oat...', 'Wikimedia\\Rdbms...') #1 /srv/mediawiki/mediawiki-1.38.2/w/includes/libs/rdbms/database/Database.php(1564): Wikimedia\Rdbms\Database->getQueryExceptionAndLog('ERROR: syntax ...', 42601, 'ALTER TABLE oat...', 'Wikimedia\\Rdbms...') #2 /srv/mediawiki/mediawiki-1.38.2/w/includes/libs/rdbms/database/Database.php(1173): Wikimedia\Rdbms\Database->reportQueryError('ERROR: syntax ...', 42601, 'ALTER TABLE oat...', 'Wikimedia\\Rdbms...', false) #3 /srv/mediawiki/mediawiki-1.38.2/w/includes/libs/rdbms/database/Database.php(4954): Wikimedia\Rdbms\Database->query('ALTER TABLE oat...', 'Wikimedia\\Rdbms...') #4 /srv/mediawiki/mediawiki-1.38.2/w/includes/libs/rdbms/database/Database.php(4889): Wikimedia\Rdbms\Database->sourceStream(Resource id #2592, NULL, NULL, 'Wikimedia\\Rdbms...', NULL) #5 /srv/mediawiki/mediawiki-1.38.2/w/includes/libs/rdbms/database/DBConnRef.php(69): Wikimedia\Rdbms\Database->sourceFile('/srv/mediawiki/...') #6 /srv/mediawiki/mediawiki-1.38.2/w/includes/libs/rdbms/database/MaintainableDBConnRef.php(35): Wikimedia\Rdbms\DBConnRef->__call('sourceFile', Array) #7 /srv/mediawiki/mediawiki-1.38.2/w/includes/installer/DatabaseUpdater.php(704): Wikimedia\Rdbms\MaintainableDBConnRef->sourceFile('/srv/mediawiki/...') #8 /srv/mediawiki/mediawiki-1.38.2/w/includes/installer/DatabaseUpdater.php(1019): DatabaseUpdater->applyPatch('/srv/mediawiki/...', true, 'Modifying id fi...') #9 /srv/mediawiki/mediawiki-1.38.2/w/includes/installer/DatabaseUpdater.php(533): DatabaseUpdater->modifyField('oathauth_users', 'id', '/srv/mediawiki/...', true) #10 /srv/mediawiki/mediawiki-1.38.2/w/includes/installer/DatabaseUpdater.php(501): DatabaseUpdater->runUpdates(Array, true) #11 /srv/mediawiki/mediawiki-1.38.2/w/maintenance/update.php(193): DatabaseUpdater->doUpdates(Array) #12 /srv/mediawiki/mediawiki-1.38.2/w/maintenance/doMaintenance.php(114): UpdateMediaWiki->execute() #13 /srv/mediawiki/mediawiki-1.38.2/w/maintenance/update.php(264): require_once('/srv/mediawiki/...') #14 {main}
What should have happened instead?:
The upgrade should have completed without error.
As far as I know, 'ALTER TABLE x CHANGE' , which works on MySQL, is not valid on PostgreSQL. https://dataschool.com/learn-sql/using-alter-in-postgresql/
Software version (skip for WMF-hosted wikis like Wikipedia):
Mediawiki 1.38.2
Debian 11.4 'Bullseye'
PostgreSQL 13.7
PHP 7.4.30