2

I completed successfully composer update magento 2.4.3-p1 to 2.4.4

Also my template and all modules are ready for 2.4.4 magento

But in setup:upgrade

I got this:

Unable to apply data patch Magento\Catalog\Setup\Patch\Data\UpdateMultiselectAttributesBackendTypes for module Magento_Catalog. Original exception message: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '4650-1028-0' for key 'catalog_product_entity_text.CATALOG_PRODUCT_ENTITY_TEXT_ROW_ID_ATTRIBUTE_ID_STORE_ID', query was: INSERT  INTO `catalog_product_entity_text` (`value_id`,`attribute_id`,`store_id`,`row_id`,`value`) VALUES (?, ?, ?, ?, ?), (?, ?, ?, ?, ?), (?, ?, ?, ?, ?), (?, ?, ?, ?, ?),

and the ? continue more and more.

I search in this table: catalog_product_entity_text For duplicate but I cannot identify any.

Has anyone faced this error? Any solution please?

8
  • did have bundle products?
    – S.P
    May 6, 2022 at 5:16
  • try with $this->moduleDataSetup->getConnection()->insertOnDuplicate,
    – S.P
    May 6, 2022 at 5:21
  • @S.P I don't have bundle product. Only simple and configurable
    – G. G.
    May 6, 2022 at 8:40
  • @S.P Also I don't understand exactly where to put your code please? In which line?
    – G. G.
    May 6, 2022 at 9:01
  • I am not sure but magento previous 2.4.4 have not vendor/magento/module-catalog/Setup/Patch/Data/UpdateMultiselectAttributesBackendTypes.php file. Check in UpdateMultiselectAttributesBackendTypes.php file
    – S.P
    May 6, 2022 at 9:42

1 Answer 1

5

I had same issue after migrate of Magento version. I was used insertOnDuplicate .

Update magento file.

vendor/magento/module-catalog/Setup/Patch/Data/UpdateMultiselectAttributesBackendTypes.php

around line num:89 you will find

foreach (array_chunk($dataToMigrate, 2000) as $dataChunk) {
    $connection->insertMultiple($textTable, $dataChunk);
}

use insertOnDuplicate there.

foreach (array_chunk($dataToMigrate, 2000) as $dataChunk) {
    foreach($dataChunk as $single) {
        $connection->insertOnDuplicate($textTable, $dataChunk);
    }
}
9
  • Is there a reason this issue still exists if it's a known Magento code bug as I am running into the same issue now?
    – cnu
    Sep 11, 2022 at 18:43
  • Shouldn't this be $connection->insertOnDuplicate($textTable, $single); ?
    – kipzes
    May 19, 2023 at 6:46
  • After applying this change , the setup:upgrade command is stuckes and never stops. Unable to apply data patch Magento\Catalog\Setup\Patch\Data\UpdateMultiselectAttributesBackendTypes for module Magento_Catalog. Original exception message: SQLSTATE[HY000]: General error: 1205 Lock wait timeout exceeded; try restarting transaction, query was: INSERT INTO mgcp_catalog_product_entity_text (value_id,attribute_id,store_id,entity_id,value) VALUES Jun 29, 2023 at 11:43
  • @Kishor6ugani Check with your custom module disabled. If you have recent added any custom module then disable it and check.
    – S.P
    Jul 3, 2023 at 10:07
  • disabled all the 3rd party modules , but still setup:upgrade stuck on Magento_Catalog Jul 4, 2023 at 7:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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