Last modified: 2013-10-23 18:17:00 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T35228, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 33228 - Various tables missing PK when upgraded from ancient versions of MW
Various tables missing PK when upgraded from ancient versions of MW
Status: RESOLVED DUPLICATE of bug 15441
Product: MediaWiki
Classification: Unclassified
Database (Other open bugs)
1.18.x
All All
: Low normal (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2011-12-17 21:39 UTC by Joerg
Modified: 2013-10-23 18:17 UTC (History)
2 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments
Output of mysqldump --no-data (43.88 KB, text/plain)
2012-01-08 22:43 UTC, Joerg
Details

Description Joerg 2011-12-17 21:39:10 UTC
In my database I have no Primary Key in the table users.
This makes it impossible to edit this table e.g. using the MySQL Workbench. You get the error message "table data is not editable because there is no primary key defined for the table."

Maybe the updater should to care that the Primary Key is set and set it, if it is missing.

I use MediaWiki 1.18.
Comment 1 John Du Hart 2011-12-17 21:40:31 UTC
Issue is likely due to r5210, user_id was converted to a PRIMARY KEY but a patch was never made.
Comment 2 Joerg 2011-12-17 22:44:19 UTC
The problem is also present for a number of other tables as well, for example "cur", "math", "text", "user_rights" or "watchlist".
Comment 3 Sam Reed (reedy) 2011-12-18 00:23:41 UTC
(In reply to comment #2)
> The problem is also present for a number of other tables as well, for example
> "cur", "math", "text", "user_rights" or "watchlist".

Of course, math is now in an extension
Comment 4 Sam Reed (reedy) 2011-12-18 01:33:10 UTC
What version was that wiki installed at? Out of interest...
Comment 5 Joerg 2011-12-18 16:22:27 UTC
It surely used MW 1.4 and maybe also an earlier version.
Comment 6 John Du Hart 2011-12-18 17:46:42 UTC
Given that the earliest database entry was May 2004 it was probably 1.2 or 1.3
Comment 7 Joerg 2012-01-04 23:45:02 UTC
Yes, that is quite likely.
Comment 8 Sam Reed (reedy) 2012-01-04 23:58:42 UTC
John, as you assigned this to yourself, are you likely to get round to it any time soon?

Might be nice to get it in 1.19/1.18.1, finally!
Comment 9 Sam Reed (reedy) 2012-01-05 00:56:44 UTC
(In reply to comment #7)
> Yes, that is quite likely.

Any chance you could do a dump of your database schema layout? Gives a slightly nicer working point, rather than a list of old (now somewhat renamed) tables

SHOW CREATE TABLE tablename;


mysql> show create table user\G
*************************** 1. row ***************************
       Table: user
Create Table: CREATE TABLE `user` (
  `user_id` int(5) unsigned NOT NULL AUTO_INCREMENT,
  `user_name` varbinary(255) NOT NULL DEFAULT '',
  `user_real_name` varbinary(255) NOT NULL DEFAULT '',
  `user_password` tinyblob NOT NULL,
  `user_newpassword` tinyblob NOT NULL,
  `user_email` tinyblob NOT NULL,
  `user_options` blob NOT NULL,
  `user_touched` varbinary(14) NOT NULL DEFAULT '',
  `user_token` varbinary(32) NOT NULL DEFAULT '',
  `user_email_authenticated` varbinary(14) DEFAULT NULL,
  `user_email_token` varbinary(32) DEFAULT NULL,
  `user_email_token_expires` varbinary(14) DEFAULT NULL,
  `user_registration` varbinary(14) DEFAULT NULL,
  `user_newpass_time` varbinary(14) DEFAULT NULL,
  `user_editcount` int(11) DEFAULT NULL,
  PRIMARY KEY (`user_id`),
  UNIQUE KEY `user_name` (`user_name`),
  KEY `user_email_token` (`user_email_token`)
) ENGINE=InnoDB AUTO_INCREMENT=16029390 DEFAULT CHARSET=binary
1 row in set (0.00 sec)
Comment 10 Joerg 2012-01-08 22:43:38 UTC
Created attachment 9824 [details]
Output of mysqldump --no-data

Attached is the DB structure, which I got with
mysqldump --nodata

Only 19 tables do have a primary key. And I don't know, if these are how they should be).
Comment 11 Sam Reed (reedy) 2012-01-10 11:55:21 UTC
Just found bug 15441 for note


(In reply to comment #0)
> It seems that some tables do not have primary keys nor any unique attributes
> declared:
> 
>  -  7 with MySQL [archive externallinks hitcounter oldimage querycache
> querycachetwo user_newtalk]).
>
Comment 12 Sam Reed (reedy) 2012-01-10 15:12:32 UTC
(In reply to comment #10)
> Created attachment 9824 [details]
> Output of mysqldump --no-data
> 
> Attached is the DB structure, which I got with
> mysqldump --nodata
> 
> Only 19 tables do have a primary key. And I don't know, if these are how they
> should be).

FYI


(In reply to comment #2)
> No PK (but has unique index):
> categorylinks
> change_tag
> imagelinks
> interwiki
> iwlinks
> langlinks
> log_search
> module_deps
> msg_resource
> msg_resource_links
> page_props
> oagelinks
> protected_titles
> querycache_info
> searchindex
> site_stats
> tag_summary
> templatelinks
> transcache
> user_former_groups
> user_groups
> 
> No PK or unique index:
> archive
> externallinks
> hitcounter
> l10n_cache
> oldimage
> querycache
> querycachetwo
> user_newtalk



In your DB install, all these tables aren't needed (trackback is newly gone). Cleaned up in r108502

			'blobs', // 1.4
			'brokenlinks', // 1.4
			'cur', // 1.4
			'ip_blocks_old', // Temporary in 1.6
			'links', // 1.4
			'linkscc', // 1.4
			'old', // 1.4
			'trackback', // 1.19
			'user_rights', // 1.5
			'validate', // 1.6


Your text table is very out of date (numerous extra fields and indexes). I've added code in r108504 to tidy this up
Comment 13 Sam Reed (reedy) 2012-01-10 15:23:17 UTC
After a lot of reading today, I'm going to mark this as a duplicate of bug 15441

There are unique keys in place where there should be primary keys...

The only difference I can see of a Primary Key vs a Unique Key, is a PK CANNOT be null

Therefore they should be pretty much identical...

*** This bug has been marked as a duplicate of bug 15441 ***

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links