It needs one.
Description
Details
Subject | Repo | Branch | Lines +/- | |
---|---|---|---|---|
Add primary key to change_tag and tag_summary tables | mediawiki/core | master | +110 -4 |
Status | Subtype | Assigned | Task | |
---|---|---|---|---|
· · · | ||||
Resolved | LSobanski | T17441 Some tables lack unique or primary keys, may allow confusing duplicate data | ||
Resolved | TTO | T123225 change_tag doesn't have a primary key | ||
Resolved | Marostegui | T147166 Apply change_tag and tag_summary primary key schema change to Wikimedia wikis | ||
· · · |
Event Timeline
Change 304165 had a related patch set uploaded (by TTO):
Add primary key to change_tag and tag_summary tables
So what I asked on the ticket is a simple, one line justification of "a new auto_increment column is the best option for a primary key because...".
I think I answered that quite extensively on the patch? Or did you want some more info?
Just reposting my comment here for posterity:
I don't think converting any of the existing keys will work, as the contents of the tables generally look like this:
$ MariaDB [enwiki_p]> (select * from change_tag where ct_log_id is null limit 1) union all (select * from change_tag where ct_rc_id is null limit 1) union all (select * from change_tag where ct_rev_id is null limit 1); +-----------+-----------+-----------+------------------+-----------+ | ct_rc_id | ct_log_id | ct_rev_id | ct_tag | ct_params | +-----------+-----------+-----------+------------------+-----------+ | 774304154 | NULL | 690405091 | End of page text | NULL | | NULL | NULL | 591814806 | WPCleaner | NULL | | 681941033 | 59010411 | NULL | HHVM | NULL | +-----------+-----------+-----------+------------------+-----------+ 3 rows in set (0.01 sec)Note all the NULLs in various places. The tag_summary table looks similar.
It would most likely work if we had a primary key on (ct_rc_id,ct_rev_id,ct_log_id,ct_tag), but that is a very unwieldy primary key, and I think you are trying to get rid of such abominations.
Thank you @TTO, I could not find it on the gerrit comments. Too many alters to review. Copying it here (or alternatively, on the gerrit summary it would have been ok) makes it clearer to me.
Here you have my +1.
Change 304165 merged by jenkins-bot:
Add primary key to change_tag and tag_summary tables