Steps to replicate the issue (include links if applicable):
- Fork wiki from fandom
- Upgrade to 1.37.6 successfully
- Switch to 1.39.2 installation files and run update.php
What happens?:
Modifying tl_namespace field of table templatelinks...Wikimedia\Rdbms\DBQueryError from line 1618 of w/includes/libs/rdbms/database/Database.php: Error 1062: Duplicate entry '62841-575' for key 'PRIMARY' Function: Wikimedia\Rdbms\Database::sourceFile( w/maintenance/archives/patch-templatelinks-tl_title-nullable.sql ) Query: ALTER TABLE `templatelinks` ADD PRIMARY KEY (tl_from, tl_target_id)
select * from templatelinks where tl_from='62841' and tl_target_id='575'; +---------+--------------+----------+-------------------+--------------+ | tl_from | tl_namespace | tl_title | tl_from_namespace | tl_target_id | +---------+--------------+----------+-------------------+--------------+ | 62841 | 0 | | 6 | 575 | | 62841 | 10 | FileInfo | 6 | 575 | +---------+--------------+----------+-------------------+--------------+
Rows with tl_namespace='0' and tl_title='' are created in the database. Found a total of 12 of these entries in the database. After deleting them, and recreating a PRIMARY KEY (to avoid T324646), the rerunning the update completed successfully.
Software version (skip for WMF-hosted wikis like Wikipedia):
- PHP 7.4.3
- MariaDB 10.3.38
Seems similar to T324516, but this is MariaDB.