Page MenuHomePhabricator

Database update from 1.37.2 to 1.39.0 fails on Postgres with "ERROR: multiple primary keys for table "templatelinks" are not allowed"
Closed, ResolvedPublicBUG REPORT

Description

Steps to replicate the issue (include links if applicable):

  • Install v1.37.2 with Postgres
  • Replace the codebase with v.1.39.0
  • Run update.php in the maintenance/ dir

What happens?:

MediaWiki 1.39.0 Updater

Your composer.lock file is up to date with current dependencies!
Going to run database updates for mediawiki-mediawiki-
Depending on the size of your database this may take a while!
Abort with control-c in the next five seconds (skip this countdown with --quick) ...0
...collations up-to-date.
...column 'revision.rev_actor' already exists
...index 'rev_actor_timestamp' on table 'revision' already exists
...index 'rev_page_actor_timestamp' on table 'revision' already exists
...column 'image.img_description_id' already exists
...slots table already exists.
...slots table does not contain slot_inherited field.
...column 'slots.slot_origin' already exists
...index 'slot_revision_origin_role' on table 'slots' already exists
...content table already exists.
...content_models table already exists.
...slot_roles table already exists.
...actor table already exists.
...column 'archive.ar_actor' already exists
...column 'ipblocks.ipb_by_actor' already exists
...column 'image.img_actor' already exists
...column 'oldimage.oi_actor' already exists
...column 'filearchive.fa_actor' already exists
...column 'recentchanges.rc_actor' already exists
...column 'logging.log_actor' already exists
...index 'logging_actor_time_backwards' on table 'logging' already exists
...index 'logging_actor_type_time' on table 'logging' already exists
Creating index 'logging_actor_time' on table 'logging' ( log_actor, log_timestamp )
...table site_stats already modified by patch patch-site_stats-modify.sql.
...index 'rc_namespace_title_timestamp' on table 'recentchanges' already exists
Setting sequence user_user_id_seq owner to user.user_id
Setting sequence actor_actor_id_seq owner to actor.actor_id
Setting sequence page_page_id_seq owner to page.page_id
Setting sequence revision_rev_id_seq owner to revision.rev_id
Setting sequence text_old_id_seq owner to text.old_id
Setting sequence comment_comment_id_seq owner to comment.comment_id
Setting sequence page_restrictions_pr_id_seq owner to page_restrictions.pr_id
Setting sequence archive_ar_id_seq owner to archive.ar_id
Setting sequence content_content_id_seq owner to content.content_id
Setting sequence slot_roles_role_id_seq owner to slot_roles.role_id
Setting sequence content_models_model_id_seq owner to content_models.model_id
Setting sequence externallinks_el_id_seq owner to externallinks.el_id
Setting sequence ipblocks_ipb_id_seq owner to ipblocks.ipb_id
Setting sequence filearchive_fa_id_seq owner to filearchive.fa_id
Setting sequence uploadstash_us_id_seq owner to uploadstash.us_id
Setting sequence recentchanges_rc_id_seq owner to recentchanges.rc_id
Setting sequence watchlist_wl_id_seq owner to watchlist.wl_id
Setting sequence logging_log_id_seq owner to logging.log_id
Setting sequence job_job_id_seq owner to job.job_id
Setting sequence category_cat_id_seq owner to category.cat_id
Setting sequence change_tag_ct_id_seq owner to change_tag.ct_id
Setting sequence sites_site_id_seq owner to sites.site_id
...change_tag_def table already exists.
Running maintenance/deduplicateArchiveRevId.php...
...Update 'DeduplicateArchiveRevId' already logged as completed. Use --force to run it again.
done.
...column 'change_tag.ct_tag_id' already exists
...index 'change_tag_tag_id_id' on table 'change_tag' already exists
...index 'ar_revid_uniq' on table 'archive' already exists
...index 'log_type_action' on table 'logging' already exists
...index interwiki_pkey already set on interwiki table.
...index protected_titles_pkey already set on protected_titles table.
...index site_identifiers_pkey already set on site_identifiers table.
...index 'rc_this_oldid' on table 'recentchanges' already exists
...transcache doesn't exist.
Running maintenance/populateChangeTagDef.php...
...Update 'PopulateChangeTagDef' already logged as completed. Use --force to run it again.
done.
...change_tag_rc_tag key doesn't exist.
...column 'ipblocks.ipb_sitewide' already exists
...ipblocks_restrictions table already exists.
...category table does not contain cat_hidden field.
...site_stats table does not contain ss_admins field.
...recentchanges table does not contain rc_cur_time field.
...change_tag table does not contain ct_tag field.
...valid_tag doesn't exist.
...tag_summary doesn't exist.
...archive table does not contain ar_comment field.
...ipblocks table does not contain ipb_reason field.
...image table does not contain img_description field.
...oldimage table does not contain oi_description field.
...filearchive table does not contain fa_deleted_reason field.
...filearchive table does not contain fa_description field.
...recentchanges table does not contain rc_comment field.
...logging table does not contain log_comment field.
...protected_titles table does not contain pt_reason field.
...archive table does not contain ar_user field.
...archive table does not contain ar_user_text field.
...ipblocks table does not contain ipb_by field.
...ipblocks table does not contain ipb_by_text field.
...image table does not contain img_user field.
...image table does not contain img_user_text field.
...oldimage table does not contain oi_user field.
...oldimage table does not contain oi_user_text field.
...filearchive table does not contain fa_user field.
...filearchive table does not contain fa_user_text field.
...recentchanges table does not contain rc_user field.
...recentchanges table does not contain rc_user_text field.
...logging table does not contain log_user field.
...logging table does not contain log_user_text field.
...index redirect_pkey already set on redirect table.
...watchlist_expiry table already exists.
Changing 'user_newtalk.user_ip' default value
...column 'user_newtalk.user_ip' is already set as NOT NULL
Changing 'user_newtalk.user_id' default value
...revision table does not contain rev_user field.
...revision table does not contain rev_user_text field.
...revision table does not contain rev_comment field.
...revision table does not contain rev_text_id field.
...revision table does not contain rev_content_model field.
...revision table does not contain rev_content_format field.
...column 'revision.rev_comment_id' already exists
...archive table does not contain ar_text_id field.
...archive table does not contain ar_content_model field.
...archive table does not contain ar_content_format field.
Changing column type of 'updatelog.ul_key' from 'varchar' to 'varchar(255)'
...column 'updatelog.ul_value' is already of type 'TEXT'
...column 'site_identifiers.si_type' is already of type 'TEXT'
...column 'site_identifiers.si_key' is already of type 'TEXT'
...column 'actor.actor_id' is already of type 'BIGINT'
...column 'actor.actor_name' is already of type 'TEXT'
...column 'user_former_groups.ufg_group' is already of type 'TEXT'
...foreign key constraint on 'user_former_groups.ufg_user' already does not exist
...no need to drop index 'ipb_address_unique'
...index 'ipb_address_unique' exists
Changing 'bot_passwords.bp_token' default value
...column 'comment.comment_id' is already of type 'BIGINT'
...column 'slots.slot_revision_id' is already of type 'BIGINT'
...column 'slots.slot_content_id' is already of type 'BIGINT'
...column 'slots.slot_origin' is already of type 'BIGINT'
...column 'site_stats.ss_total_edits' is already of type 'BIGINT'
...column 'site_stats.ss_good_articles' is already of type 'BIGINT'
...column 'site_stats.ss_total_pages' is already of type 'BIGINT'
...column 'site_stats.ss_users' is already of type 'BIGINT'
...column 'site_stats.ss_active_users' is already of type 'BIGINT'
...column 'site_stats.ss_images' is already of type 'BIGINT'
...foreign key constraint on 'user_properties.up_user' already does not exist
...index user_properties_pkey already set on user_properties table.
Changing column type of 'log_search.ls_value' from 'varchar' to 'VARCHAR(255)'
...column 'content.content_id' is already of type 'BIGINT'
...column 'l10n_cache.lc_value' is already of type 'TEXT'
Changing column type of 'l10n_cache.lc_key' from 'varchar' to 'VARCHAR(255)'
...index l10n_cache_pkey already set on l10n_cache table.
...index module_deps_pkey already set on module_deps table.
Changing column type of 'redirect.rd_namespace' from 'integer' to 'INT'
Changing 'redirect.rd_title' default value
Changing 'redirect.rd_from' default value
...foreign key constraint on 'redirect.rd_from' already does not exist
Changing column type of 'redirect.rd_interwiki' from 'varchar' to 'VARCHAR(32)'
...foreign key constraint on 'pagelinks.pl_from' already does not exist
Changing column type of 'pagelinks.pl_namespace' from 'integer' to 'INT'
Changing 'pagelinks.pl_title' default value
...index 'pl_namespace' on table 'pagelinks' already exists
...index 'pl_backlinks_namespace' on table 'pagelinks' already exists
...foreign key constraint on 'templatelinks.tl_from' already does not exist
...foreign key constraint on 'imagelinks.il_from' already does not exist
Changing 'imagelinks.il_to' default value
...index 'il_to' on table 'imagelinks' already exists
...index 'il_backlinks_namespace' on table 'imagelinks' already exists
...foreign key constraint on 'langlinks.ll_from' already does not exist
...index langlinks_pkey already set on langlinks table.
...index ll_lang already set on langlinks table.
Changing 'langlinks.ll_lang' default value
Changing 'langlinks.ll_from' default value
Changing 'langlinks.ll_title' default value
...column 'langlinks.ll_lang' is already set as NOT NULL
...column 'langlinks.ll_title' is already set as NOT NULL
...index iwlinks_pkey already set on iwlinks table.
...index cat_title already set on category table.
...index cat_pages already set on category table.
...column 'change_tag_def.ctd_count' is already of type 'BIGINT'
...foreign key constraint on 'ipblocks_restrictions.ir_ipb_id' already does not exist
Changing 'querycache.qc_value' default value
Changing column type of 'querycache.qc_namespace' from 'integer' to 'INT'
Changing 'querycache.qc_title' default value
...index qc_type already set on querycache table.
...index qcc_type already set on querycachetwo table.
...index qcc_title already set on querycachetwo table.
...index qcc_titletwo already set on querycachetwo table.
...foreign key constraint on 'page_restrictions.pr_page' already does not exist
...index 'pr_pagetype' on table 'page_restrictions' already exists
...index 'pr_typelevel' on table 'page_restrictions' already exists
...index 'pr_level' on table 'page_restrictions' already exists
...index 'pr_cascade' on table 'page_restrictions' already exists
...no need to change primary key of 'page_restrictions'
...column 'page_restrictions.pr_page' is already set as NOT NULL
...foreign key constraint on 'user_groups.ug_user' already does not exist
Changing 'user_groups.ug_user' default value
Changing 'user_groups.ug_group' default value
...index ug_group already set on user_groups table.
...index ug_expiry already set on user_groups table.
...WARNING: user_groups_expiry still exists, despite it has been renamed into ug_expiry (which also exists).
            user_groups_expiry should be manually removed if not needed anymore.
Changing 'querycache_info.qci_type' default value
Changing 'querycache_info.qci_timestamp' default value
...column 'querycache_info.qci_type' is already set as NOT NULL
...column 'querycache_info.qci_timestamp' is already set as NOT NULL
...index querycache_info_pkey already set on querycache_info table.
Changing 'watchlist.wl_title' default value
Changing column type of 'watchlist.wl_namespace' from 'integer' to 'INT'
...foreign key constraint on 'watchlist.wl_user' already does not exist
...index 'namespace_title' on table 'watchlist' already exists
Dropping obsolete version of index 'wl_user'
Creating index 'wl_user'
Changing column type of 'sites.site_domain' from 'varchar' to 'VARCHAR(255)'
...index sites_group already set on sites table.
WARNING! Column 'user_newtalk.user_id ' does not exist but it should! Please report this.
...index un_user_id already set on user_newtalk table.
...index un_user_ip already set on user_newtalk table.
Changing column type of 'interwiki.iw_prefix' from 'varchar' to 'VARCHAR(32)'
Changing column type of 'interwiki.iw_wikiid' from 'varchar' to 'VARCHAR(64)'
...foreign key constraint on 'protected_titles.pt_user' already does not exist
...column 'protected_titles.pt_user' is already set as NOT NULL
...column 'protected_titles.pt_expiry' is already set as NOT NULL
...column 'protected_titles.pt_reason_id' is already of type 'BIGINT'
...foreign key constraint on 'externallinks.el_from' already does not exist
Changing 'externallinks.el_from' default value
...column 'externallinks.el_index_60' is already of type 'TEXT'
...index el_from already set on externallinks table.
...index el_index already set on externallinks table.
...index 'el_to' on table 'externallinks' already exists
...column 'ip_changes.ipc_hex' is already of type 'TEXT'
Changing 'ip_changes.ipc_rev_id' default value
...column 'revision_comment_temp.revcomment_comment_id' is already of type 'BIGINT'
...index wl_namespace_title already set on watchlist table.
...WARNING: namespace_title still exists, despite it has been renamed into wl_namespace_title (which also exists).
            namespace_title should be manually removed if not needed anymore.
...foreign key constraint on 'page_props.pp_page' already does not exist
...no need to change primary key of 'page_props'
Changing 'job.job_cmd' default value
...column 'job.job_namespace' is already of type 'INTEGER'
...index 'job_cmd' on table 'job' already exists
...index job_timestamp already set on job table.
...column 'slot_roles.role_id' is already of type 'INTEGER'
...column 'content_models.model_id' is already of type 'INTEGER'
...index page_len already set on page table.
...index page_random already set on page table.
...index page_name_title already set on page table.
...index 'page_redirect_namespace_len' on table 'page' already exists
...foreign key constraint on 'categorylinks.cl_from' already does not exist
Changing 'categorylinks.cl_from' default value
Changing 'categorylinks.cl_to' default value
Changing 'categorylinks.cl_sortkey' default value
Changing 'categorylinks.cl_collation' default value
...column 'categorylinks.cl_sortkey' is already set as NOT NULL
...index categorylinks_pkey already set on categorylinks table.
...index 'cl_timestamp' on table 'categorylinks' already exists
...index 'cl_collation_ext' on table 'categorylinks' already exists
Dropping obsolete version of index 'cl_sortkey'
Creating index 'cl_sortkey'
...skipping: index logging_type_name doesn't exist.
...index actor_time already set on logging table.
...WARNING: logging_actor_time_backwards still exists, despite it has been renamed into actor_time (which also exists).
            logging_actor_time_backwards should be manually removed if not needed anymore.
...skipping: index logging_page_time doesn't exist.
...skipping: index logging_times doesn't exist.
...index log_actor_type_time already set on logging table.
...WARNING: logging_actor_type_time still exists, despite it has been renamed into log_actor_type_time (which also exists).
            logging_actor_type_time should be manually removed if not needed anymore.
...index log_page_id_time already set on logging table.
...index log_type_action already set on logging table.
...column 'logging.log_params' is already set as NOT NULL
Changing 'logging.log_action' default value
Changing 'logging.log_type' default value
Changing 'logging.log_title' default value
Changing 'logging.log_timestamp' default value
...column 'logging.log_actor' is already of type 'BIGINT'
...column 'logging.log_comment_id' is already of type 'BIGINT'
Changing column type of 'logging.log_namespace' from 'integer' to 'INT'
Dropping obsolete index 'logging_actor_time'
Changing column type of 'uploadstash.us_key' from 'varchar' to 'VARCHAR(255)'
Changing column type of 'uploadstash.us_orig_path' from 'varchar' to 'VARCHAR(255)'
Changing column type of 'uploadstash.us_path' from 'varchar' to 'VARCHAR(255)'
Changing column type of 'uploadstash.us_source_type' from 'varchar' to 'VARCHAR(50)'
...column 'uploadstash.us_props' is already of type 'TEXT'
Changing column type of 'uploadstash.us_status' from 'varchar' to 'VARCHAR(50)'
Changing column type of 'uploadstash.us_sha1' from 'varchar' to 'VARCHAR(31)'
Changing column type of 'uploadstash.us_mime' from 'varchar' to 'VARCHAR(255)'
...column 'uploadstash.us_key' is already set as NOT NULL
...column 'uploadstash.us_user' is already set as NOT NULL
...column 'uploadstash.us_orig_path' is already set as NOT NULL
...column 'uploadstash.us_path' is already set as NOT NULL
...column 'uploadstash.us_timestamp' is already set as NOT NULL
...column 'uploadstash.us_status' is already set as NOT NULL
...column 'uploadstash.us_size' is already set as NOT NULL
...column 'uploadstash.us_sha1' is already set as NOT NULL
...index us_user already set on uploadstash table.
...index us_key already set on uploadstash table.
...index us_timestamp already set on uploadstash table.
...index up_property already set on user_properties table.
...skipping: index sites_group,  doesn't exist.
...index log_type_time already set on logging table.
...index log_actor_time already set on logging table.
...WARNING: actor_time still exists, despite it has been renamed into log_actor_time (which also exists).
            actor_time should be manually removed if not needed anymore.
...index log_page_time already set on logging table.
...index log_times already set on logging table.
Changing 'filearchive.fa_name' default value
Changing 'filearchive.fa_archive_name' default value
Changing 'filearchive.fa_storage_key' default value
...foreign key constraint on 'filearchive.fa_deleted_user' already does not exist
...column 'filearchive.fa_deleted_reason_id' is already of type 'BIGINT'
...column 'filearchive.fa_metadata' is already of type 'TEXT'
...column 'filearchive.fa_bits' is already of type 'INTEGER'
...column 'filearchive.fa_description_id' is already of type 'BIGINT'
...column 'filearchive.fa_actor' is already of type 'BIGINT'
...index fa_name already set on filearchive table.
...index fa_storage_group already set on filearchive table.
...index fa_deleted_timestamp already set on filearchive table.
...index 'fa_actor_timestamp' on table 'filearchive' already exists
...index 'ipb_expiry' on table 'ipblocks' already exists
...index 'ipb_timestamp' on table 'ipblocks' already exists
...index text_pkey already set on text table.
...column 'text.old_text' is already set as NOT NULL
...column 'text.old_flags' is already set as NOT NULL
Changing 'oldimage.oi_name' default value
Changing 'oldimage.oi_archive_name' default value
Changing 'oldimage.oi_size' default value
Changing 'oldimage.oi_width' default value
Changing 'oldimage.oi_height' default value
Changing 'oldimage.oi_bits' default value
Changing 'oldimage.oi_name' default value
...column 'oldimage.oi_bits' is already of type 'INTEGER'
...column 'oldimage.oi_description_id' is already of type 'BIGINT'
...column 'oldimage.oi_actor' is already of type 'BIGINT'
...column 'oldimage.oi_metadata' is already of type 'TEXT'
...column 'oldimage.oi_minor_mime' is already set as NOT NULL
...column 'oldimage.oi_minor_mime' is already set as NOT NULL
...foreign key constraint on 'oldimage.oi_name' already does not exist
...index 'oi_actor_timestamp' on table 'oldimage' already exists
...index 'rc_ns_actor' on table 'recentchanges' already exists
...index 'rc_actor' on table 'recentchanges' already exists
...keyname key doesn't exist.
...column 'objectcache.value' is already of type 'TEXT'
...column 'objectcache.value' is already set as NULL
...foreign key constraint on 'ipblocks.ipb_user' already does not exist
...foreign key constraint on 'ipblocks.ipb_parent_block_id' already does not exist
Changing 'ipblocks.ipb_user' default value
...column 'ipblocks.ipb_user' is already set as NOT NULL
...column 'ipblocks.ipb_range_start' is already set as NOT NULL
...column 'ipblocks.ipb_range_end' is already set as NOT NULL
...column 'ipblocks.ipb_by_actor' is already of type 'BIGINT'
...column 'ipblocks.ipb_reason_id' is already of type 'BIGINT'
...index ar_name_title_timestamp already set on archive table.
...index 'ar_actor_timestamp' on table 'archive' already exists
Changing 'image.img_name' default value
Changing 'image.img_size' default value
Changing 'image.img_width' default value
Changing 'image.img_height' default value
Changing 'image.img_bits' default value
...column 'image.img_bits' is already of type 'INTEGER'
...column 'image.img_description_id' is already of type 'BIGINT'
...column 'image.img_actor' is already of type 'BIGINT'
...column 'image.img_metadata' is already of type 'TEXT'
...column 'image.img_major_mime' is already set as NOT NULL
...column 'image.img_minor_mime' is already set as NOT NULL
...column 'image.img_timestamp' is already set as NOT NULL
...index img_size already set on image table.
...index img_timestamp already set on image table.
...index 'img_actor_timestamp' on table 'image' already exists
...index 'img_media_mime' on table 'image' already exists
...index si_site already set on site_identifiers table.
...index si_key already set on site_identifiers table.
...column 'recentchanges.rc_actor' is already of type 'BIGINT'
...column 'recentchanges.rc_comment_id' is already of type 'BIGINT'
...column 'recentchanges.rc_ip' is already of type 'TEXT'
...column 'recentchanges.rc_namespace' is already of type 'INTEGER'
Changing 'recentchanges.rc_title' default value
Changing 'recentchanges.rc_source' default value
Changing 'recentchanges.rc_ip' default value
Changing 'recentchanges.rc_namespace' default value
Changing 'recentchanges.rc_cur_id' default value
Changing 'recentchanges.rc_this_oldid' default value
Changing 'recentchanges.rc_last_oldid' default value
...column 'recentchanges.rc_cur_id' is already set as NOT NULL
...column 'recentchanges.rc_ip' is already set as NOT NULL
...index rc_new_name_timestamp already set on recentchanges table.
...column 'archive.ar_namespace' is already of type 'INTEGER'
Changing 'archive.ar_namespace' default value
Changing 'archive.ar_title' default value
...column 'archive.ar_comment_id' is already of type 'BIGINT'
...column 'archive.ar_actor' is already of type 'BIGINT'
...index user_email_token already set on user table.
...index 'user_email' on table 'user' already exists
...index 'user_name' on table 'user' already exists
...column 'page.page_namespace' is already of type 'INTEGER'
...column 'page.page_touched' is already set as NOT NULL
Changing column type of 'page.page_random' from 'float8' to 'FLOAT'
...index rev_page_id already set on revision table.
...index rev_timestamp already set on revision table.
...index 'rev_page_timestamp' on table 'revision' already exists
...column 'user.user_touched' is already set as NOT NULL
...column 'user.user_token' is already set as NOT NULL
...column 'user.user_real_name' is already set as NOT NULL
...column 'user.user_email' is already set as NOT NULL
...column 'user.user_newpassword' is already set as NOT NULL
...column 'user.user_password' is already set as NOT NULL
Changing 'user.user_name' default value
Changing 'user.user_token' default value
Changing 'user.user_real_name' default value
...have modtoken field in objectcache table.
...foreign key constraint on 'revision.rev_page' already does not exist
...column 'revision.rev_page' is already set as NOT NULL
...column 'revision.rev_comment_id' is already of type 'BIGINT'
...column 'revision.rev_actor' is already of type 'BIGINT'
Dropping obsolete version of index 'rev_page_id'
Creating index 'rev_page_id'
...searchindex table already exists.
...index 'oi_timestamp' on table 'oldimage' already exists
...index page_name_title already set on page table.
...index ct_rc_tag_id already set on change_tag table.
...index ct_log_tag_id already set on change_tag table.
...index ct_rev_tag_id already set on change_tag table.
...index ct_tag_id_id already set on change_tag table.
...WARNING: change_tag_tag_id_id still exists, despite it has been renamed into ct_tag_id_id (which also exists).
            change_tag_tag_id_id should be manually removed if not needed anymore.
Converting djvu metadata...
Finished refreshing file metadata for 0 files. 0 needed to be refreshed, 0 did not need to be but were refreshed anyways, and 0 refreshes were suspicious.
...done.
Dropping column 'page_restrictions.pr_user'
Creating linktarget table...done.
Dropping rev_page_id index from table revision...done.
Adding tl_target_id field to table templatelinks...done.
Creating user_autocreate_serial table...done.
Running maintenance/migrateRevisionActorTemp.php...
Merging the revision_actor_temp table into the revision table...
... rev_id=210, updated 200
... rev_id=419, updated 400
... rev_id=635, updated 600
... rev_id=847, updated 800
... rev_id=1119, updated 1000
... rev_id=1436, updated 1200
... rev_id=1669, updated 1400
... rev_id=1879, updated 1600
... rev_id=2084, updated 1800
... rev_id=2284, updated 2000
... rev_id=2484, updated 2200
... rev_id=2685, updated 2400
... rev_id=2885, updated 2600
... rev_id=3087, updated 2800
... rev_id=3287, updated 3000
... rev_id=3487, updated 3200
... rev_id=3687, updated 3400
... rev_id=3887, updated 3600
... rev_id=4087, updated 3800
Completed merge of revision_actor into the revision table, 3959 rows updated.
done.
Dropping table revision_actor_temp ...done.
Running maintenance/updateRestrictions.php...
...processing page IDs from 0 to 1000.
...processing page IDs from 1000 to 2000.
...Done!
done.
Dropping column 'page.page_restrictions'
Running migrateLinksTable.php on templatelinks...
Populating the tl_target_id column
Starting backfill of 10:SimplePanel title on pages between 0 and 999
Updated 40 rows
Starting backfill of 10:SimplePanel.css title on pages between 0 and 999
Updated 40 rows
Starting backfill of 10:Note title on pages between 0 and 999
Updated 4 rows
Starting backfill of 10:Warning title on pages between 0 and 999
Updated 8 rows
Starting backfill of 10:AttachmentsSectionEnd title on pages between 0 and 999
Updated 15 rows
Starting backfill of 10:AttachmentsSectionStart title on pages between 0 and 999
Updated 15 rows
Starting backfill of 10:TaskListStart title on pages between 0 and 999
Updated 130 rows
Starting backfill of 10:Task title on pages between 0 and 999
Updated 130 rows
Starting backfill of 10:TaskListEnd title on pages between 0 and 999
Updated 130 rows
Starting backfill of 10:Info title on pages between 0 and 999
Updated 29 rows
Starting backfill of 10:InlineComment title on pages between 0 and 999
Updated 3 rows
Starting backfill of 10:From title on pages between 0 and 999
Updated 1 rows
Starting backfill of 10:Body title on pages between 0 and 999
Updated 1 rows
Starting backfill of 10:Layout title on pages between 0 and 999
Updated 65 rows
Starting backfill of 10:Layout.css title on pages between 0 and 999
Updated 65 rows
Starting backfill of 10:RecentlyUpdated title on pages between 0 and 999
Updated 1 rows
Starting backfill of 10:DeptDataTable title on pages between 0 and 999
Updated 1 rows
Starting backfill of 10:Layout title on pages between 1000 and 1999
Updated 33 rows
Starting backfill of 10:Layout.css title on pages between 1000 and 1999
Updated 33 rows
Starting backfill of 10:Info title on pages between 1000 and 1999
Updated 2 rows
Starting backfill of 10:SimplePanel title on pages between 1000 and 1999
Updated 3 rows
Starting backfill of 10:SimplePanel.css title on pages between 1000 and 1999
Updated 3 rows
Starting backfill of 10:HideCategoryPrefix title on pages between 1000 and 1999
Updated 1 rows
Starting backfill of 10:AttachmentsSectionStart title on pages between 1000 and 1999
Updated 1 rows
Starting backfill of 10:AttachmentsSectionEnd title on pages between 1000 and 1999
Updated 1 rows
Starting backfill of 10:Warning title on pages between 1000 and 1999
Updated 1 rows
Starting backfill of 10:Code title on pages between 1000 and 1999
Updated 1 rows
Completed normalization of templatelinks, 757 rows updated.
done.
Changing 'templatelinks.tl_target_id' to not allow NULLs
Wikimedia\Rdbms\DBQueryError from line 1618 of /srv/mediawiki/mediawiki-1.39.0/w/includes/libs/rdbms/database/Database.php: Error 42P16: ERROR:  multiple primary keys for table "templatelinks" are not allowed

Function: PostgresUpdater::changePrimaryKey
Query: ALTER TABLE "templatelinks" ADD PRIMARY KEY (tl_from,tl_target_id);

#0 /srv/mediawiki/mediawiki-1.39.0/w/includes/libs/rdbms/database/Database.php(1602): Wikimedia\Rdbms\Database->getQueryException('ERROR:  multipl...', '42P16', 'ALTER TABLE "te...', 'PostgresUpdater...')
#1 /srv/mediawiki/mediawiki-1.39.0/w/includes/libs/rdbms/database/Database.php(1576): Wikimedia\Rdbms\Database->getQueryExceptionAndLog('ERROR:  multipl...', '42P16', 'ALTER TABLE "te...', 'PostgresUpdater...')
#2 /srv/mediawiki/mediawiki-1.39.0/w/includes/libs/rdbms/database/Database.php(952): Wikimedia\Rdbms\Database->reportQueryError('ERROR:  multipl...', '42P16', 'ALTER TABLE "te...', 'PostgresUpdater...', false)
#3 /srv/mediawiki/mediawiki-1.39.0/w/includes/libs/rdbms/database/DBConnRef.php(103): Wikimedia\Rdbms\Database->query('ALTER TABLE "te...', 'PostgresUpdater...', 0)
#4 /srv/mediawiki/mediawiki-1.39.0/w/includes/libs/rdbms/database/DBConnRef.php(293): Wikimedia\Rdbms\DBConnRef->__call('query', Array)
#5 /srv/mediawiki/mediawiki-1.39.0/w/includes/installer/PostgresUpdater.php(1111): Wikimedia\Rdbms\DBConnRef->query('ALTER TABLE "te...', 'PostgresUpdater...')
#6 /srv/mediawiki/mediawiki-1.39.0/w/includes/installer/DatabaseUpdater.php(547): PostgresUpdater->changePrimaryKey('"templatelinks"', Array, 'templatelinks_p...')
#7 /srv/mediawiki/mediawiki-1.39.0/w/includes/installer/DatabaseUpdater.php(511): DatabaseUpdater->runUpdates(Array, false)
#8 /srv/mediawiki/mediawiki-1.39.0/w/maintenance/update.php(202): DatabaseUpdater->doUpdates(Array)
#9 /srv/mediawiki/mediawiki-1.39.0/w/maintenance/includes/MaintenanceRunner.php(309): UpdateMediaWiki->execute()
#10 /srv/mediawiki/mediawiki-1.39.0/w/maintenance/doMaintenance.php(85): MediaWiki\Maintenance\MaintenanceRunner->run()
#11 /srv/mediawiki/mediawiki-1.39.0/w/maintenance/update.php(312): require_once('/srv/mediawiki/...')
#12 {main}

What should have happened instead?:

A successful database migration

Software version (skip for WMF-hosted wikis like Wikipedia):

1.39.0 (upgrading from 1.37.2)

Other information (browser name/version, screenshots, etc.):

Server: Debian 11
PHP: 7.4.33
Postgres 13.9

Event Timeline

Change 814302 had a related patch set uploaded (by Umherirrender; author: Umherirrender):

[mediawiki/core@master] postgres: Fix upgrade for templatelinks primary key

https://gerrit.wikimedia.org/r/814302

Change 864725 had a related patch set uploaded (by Ladsgroup; author: Umherirrender):

[mediawiki/core@REL1_39] postgres: Fix upgrade for templatelinks primary key

https://gerrit.wikimedia.org/r/864725

Change 864725 merged by jenkins-bot:

[mediawiki/core@REL1_39] postgres: Fix upgrade for templatelinks primary key

https://gerrit.wikimedia.org/r/864725

Change 814302 merged by jenkins-bot:

[mediawiki/core@master] postgres: Fix upgrade for templatelinks primary key

https://gerrit.wikimedia.org/r/814302

Legoktm assigned this task to Umherirrender.