0

I have imported some products into Magento 2.2.6. Everything looks correct in the backend but when I reindex I get this error-

SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '1-510' for key 'PRIMARY', query was: INSERT  INTO `temp_catalog_category_tree_index_40850d82` (`parent_id`,`child_id`) VALUES (?, ?), (?, ?), (?, ?), (?, ?), (?, ?), (?, ?), (?, ?), (?, ?), (?, 
Product Categories indexer process unknown error:
SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '1-510' for key 'PRIMARY', query was: INSERT  INTO `temp_catalog_category_tree_index_cebdbaaf` (`parent_id`,`child_id`) VALUES (?, ?), (?, ?), (?, ?), (?, ?), (?, ?), (?, ?), (?, ?), (?, ?), (?, 
Catalog Rule Product index has been rebuilt successfully in 00:00:00

I can't find that table to remove duplicate so it must be pulling from another table. Which one is it?

0

Cause of the Issue:

data corruption

Investigation:

categories with IDs 510, 511 have incorrect path values:

mysql> select row_id, entity_id, path from catalog_category_entity where path like '1/1/%';

+--------+-----------+---------+
| row_id | entity_id | path    |
+--------+-----------+---------+
|    510 |       510 | 1/1/510 |
|    511 |       511 | 1/1/511 |
+--------+-----------+---------+
2 rows in set (0.01 sec)
Resolution: not a bug
PLEASE PERFORM THE FOLLOWING ACTIONS:
execute the next SQL:
update catalog_category_entity set path = replace(path, '1/1/', '1/') 
where path like '1/1/%';

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.