Steps to replicate the issue:
- Not certain of the cause. My flaggedtemplates table contains next rows:
ft_rev_id | ft_namespace | ft_title | ft_tmp_rev_id |
---|---|---|---|
187691 | 4 | 0xEB8C80EBACB82FEAB080EC9DB4EB939C | 0 |
187691 | 4 | 0xEB8C80EBACB82FEC868CEAB09C | 0 |
187691 | 4 | 0xEB8C80EBACB82FED8E98EBAFB8EC9C84ED82A45FEAB480EBA0A85FEBACB8EC849C | 0 |
187691 | 4 | 0xEB8C80EBACB82FED9B84EC9B90 | 0 |
187691 | 4 | 0xED999CEB8F99ECA081EC9DB85FEC82ACEC9AA9EC9E90 | 0 |
- Execute update.php for MW 1.37 to 1.38.
What happens?:
Table flaggedtemplates contains ft_title field. Dropping...Wikimedia\Rdbms\DBQueryError from line 1606 of /srv/femiwiki.com/includes/libs/rdbms/database/Database.php: Error 1062: Duplicate entry '187691-0' for key 'flaggedtemplates.PRIMARY' (mysql) Function: Wikimedia\Rdbms\Database::sourceFile( /srv/femiwiki.com/extensions/FlaggedRevs/backend/schema/mysql/patch-flaggedtemplates-fr_title.sql ) Query: ALTER TABLE `flaggedtemplates` DROP PRIMARY KEY, ADD PRIMARY KEY (ft_rev_id, ft_tmp_rev_id), DROP COLUMN ft_title, DROP COLUMN ft_namespace #0 /srv/femiwiki.com/includes/libs/rdbms/database/Database.php(1590): Wikimedia\Rdbms\Database->getQueryException('Duplicate entry...', 1062, 'ALTER TABLE `fl...', 'Wikimedia\\Rdbms...') #1 /srv/femiwiki.com/includes/libs/rdbms/database/Database.php(1564): Wikimedia\Rdbms\Database->getQueryExceptionAndLog('Duplicate entry...', 1062, 'ALTER TABLE `fl...', 'Wikimedia\\Rdbms...') #2 /srv/femiwiki.com/includes/libs/rdbms/database/Database.php(1173): Wikimedia\Rdbms\Database->reportQueryError('Duplicate entry...', 1062, 'ALTER TABLE `fl...', 'Wikimedia\\Rdbms...', false) #3 /srv/femiwiki.com/includes/libs/rdbms/database/Database.php(4954): Wikimedia\Rdbms\Database->query('ALTER TABLE `fl...', 'Wikimedia\\Rdbms...') #4 /srv/femiwiki.com/includes/libs/rdbms/database/Database.php(4889): Wikimedia\Rdbms\Database->sourceStream(Resource id #2344, NULL, NULL, 'Wikimedia\\Rdbms...', NULL) #5 /srv/femiwiki.com/includes/libs/rdbms/database/DBConnRef.php(69): Wikimedia\Rdbms\Database->sourceFile('/srv/femiwiki.c...') #6 /srv/femiwiki.com/includes/libs/rdbms/database/MaintainableDBConnRef.php(35): Wikimedia\Rdbms\DBConnRef->__call('sourceFile', Array) #7 /srv/femiwiki.com/includes/installer/DatabaseUpdater.php(704): Wikimedia\Rdbms\MaintainableDBConnRef->sourceFile('/srv/femiwiki.c...') #8 /srv/femiwiki.com/includes/installer/DatabaseUpdater.php(862): DatabaseUpdater->applyPatch('/srv/femiwiki.c...', true, 'Table flaggedte...') #9 /srv/femiwiki.com/includes/installer/DatabaseUpdater.php(533): DatabaseUpdater->dropField('flaggedtemplate...', 'ft_title', '/srv/femiwiki.c...', true) #10 /srv/femiwiki.com/includes/installer/DatabaseUpdater.php(501): DatabaseUpdater->runUpdates(Array, true) #11 /srv/femiwiki.com/maintenance/update.php(193): DatabaseUpdater->doUpdates(Array) #12 /srv/femiwiki.com/maintenance/doMaintenance.php(114): UpdateMediaWiki->execute() #13 /srv/femiwiki.com/maintenance/update.php(264): require_once('/srv/femiwiki.c...') #14 {main}
What should have happened instead?:
The query should be executed.
Software version:
- FlaggedRevs was firstly installed at MediaWiki 1.34.1 in March 2022 for the wiki.
- The wiki has been gradually upgraded: 1.34.1 → 1.35.0 → ... → 1.35.2 → 1.36.0 → 1.36.1 → 1.36.2 → 1.37.0 → 1.37.2 → Disabling FlaggedRevs → 1.38.2
- The database is MySQL v8.
Other information
If it is an edge case and not worth fixing, at least I want to know the manual SQL commands to resolve this problem.