Project

General

Profile

Actions

Bug #80347

closed

sys_category_record_mm misses UNIQUE INDEX on combination of uid_local, uid_foreign, tablenames, fieldname

Added by Frans Saris about 7 years ago. Updated over 6 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Categorization API
Target version:
-
Start date:
2017-03-19
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
7
PHP Version:
Tags:
Complexity:
Is Regression:
No
Sprint Focus:

Description

Just updated a site from TYPO3 7.6 to 8.7-dev and run into a sys_refindex error.

Core: Exception handler (WEB): Uncaught TYPO3 Exception: An exception occurred while executing 'INSERT INTO `sys_refindex` (`tablename`, `recuid`, `field`, `flexpointer`, `softref_key`, `softref_id`, `sorting`, `deleted`, `workspace`, `ref_table`, `ref_uid`, `ref_string`, `hash`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)' with params ["sys_category", 4, "items", "", "", "", 32, 0, 0, "tx_news_domain_model_news", 123, "", "6a70ac7d7874ab8fe730106d85ece2fa"]: Duplicate entry '6a70ac7d7874ab8fe730106d85ece2fa' for key 'PRIMARY' | Doctrine\DBAL\Exception\UniqueConstraintViolationException thrown in file vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php in line 66. Requested URL: /typo3/index.php?M=system_dbint&moduleToken=aabfd830a0c550204cca00fcda79e7f9544

After a long search the reason was some "duplicate" rows in sys_category_record_mm.

To prevent this the sys_category_record_mm should have a UNIQUE index on uid_local, uid_foreign, tablenames, fieldname.

As a temp workarround to cleanup you sys_category_record_mm table you can run:

CREATE TABLE sys_category_record_mm2 LIKE sys_category_record_mm;
INSERT sys_category_record_mm2 SELECT * FROM sys_category_record_mm GROUP BY uid_local, uid_foreign, tablenames, fieldname;
RENAME TABLE sys_category_record_mm TO sys_category_record_mm_fout;
RENAME TABLE sys_category_record_mm2 TO sys_category_record_mm;

Related issues 2 (0 open2 closed)

Related to TYPO3 Core - Bug #80734: Upgrade Wizard: "Update the hash field of sys_refindex to exclude the sorting field" leads to an errorClosedMorton Jonuschat2017-04-06

Actions
Related to TYPO3 Core - Bug #80763: New hash version in ReferenceIndex can cause non-unique keysClosedMorton Jonuschat2017-04-08

Actions
Actions

Also available in: Atom PDF