Last modified: 2012-08-04 20:49:05 UTC

Wikimedia Bugzilla is closed!

Wikimedia has migrated from Bugzilla to Phabricator. Bug reports should be created and updated in Wikimedia Phabricator instead. Please create an account in Phabricator and add your Bugzilla email address to it.
Wikimedia Bugzilla is read-only. If you try to edit or create any bug report in Bugzilla you will be shown an intentional error message.
In order to access the Phabricator task corresponding to a Bugzilla report, just remove "static-" from its URL.
You could still run searches in Bugzilla or access your list of votes but bug reports will obviously not be up-to-date in Bugzilla.
Bug 27285 - category_title index for Pg is wrong?
category_title index for Pg is wrong?
Product: MediaWiki
Classification: Unclassified
Database (Other open bugs)
All All
: Normal normal (vote)
: ---
Assigned To: Nobody - You can work on this!
Depends on:
Blocks: postgres
  Show dependency treegraph
Reported: 2011-02-09 19:32 UTC by Mark A. Hershberger
Modified: 2012-08-04 20:49 UTC (History)
2 users (show)

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


Description Mark A. Hershberger 2011-02-09 19:32:22 UTC
Found "duplicate key value violates unique constraint "category_title"" in my logs while doing importDump and seeing that it is defined in tables.sql as

  CREATE UNIQUE INDEX category_title ON category(cat_title);

I thought there might be something wrong with the dump, but grepping for the title ("Articles_with_example_pseudocode") only found the following in my logs:

LOG:  statement: INSERT /* LinksUpdate::incrTableUpdate */ INTO categorylinks (cl_from,cl_to,cl_sortkey,cl_timestamp,cl_sortkey_prefix,cl_collation,cl_type) VALUES ('439','Articles_with_example_pseudocode','ALGORITHMS FOR CALCULATING VARIANCE
LOG:  statement: SELECT /* LinksUpdate::invalidatePages */  page_id  FROM page  WHERE page_namespace = '14' AND (page_title IN ('Statistical_algorithms','Statistical_deviation_and_dispersion','Articles_with_example_pseudocode')) AND (page_touched < '2011-02-09 18:07:14 GMT')  
LOG:  statement: INSERT /* Article::updateCategoryCounts */ INTO category (cat_id,cat_title) VALUES ('1586','Articles_with_example_pseudocode')
STATEMENT:  INSERT /* Article::updateCategoryCounts */ INTO category (cat_id,cat_title) VALUES ('1586','Articles_with_example_pseudocode')
LOG:  statement: UPDATE /* Article::updateCategoryCounts */  category SET cat_pages = cat_pages + 1 WHERE cat_title IN ('Statistical_algorithms','Statistical_deviation_and_dispersion','Articles_with_example_pseudocode') 

(The error occured on the "category" INSERT statement)
Comment 1 Greg Sabino Mullane 2011-03-21 19:54:52 UTC
I'm pretty sure the index itself is not the problem, as this is simply copied from the original MySQL tables.sql nearly verbatim.
Comment 2 Marcin Cieślak 2012-03-16 02:07:03 UTC
This is because we have INSERT IGNORE emulation there, so the error should be ignored. The debug log should say:

SQL ERROR (ignored): ....

If something wrong still happens, please update to r113534 and see if it got better; if not please include 

$wgShowExceptionDetails = true;
$wgShowSQLErrors = true;
$wgShowDBErrorBacktrace = true;
$wgDebugDumpSql  = true;
$wgDebugDBTransactions  = true;

in your LocalSettings.php

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