Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Indexation fails with constraint violation #5

Open
denos opened this issue Apr 20, 2012 · 4 comments
Open

Indexation fails with constraint violation #5

denos opened this issue Apr 20, 2012 · 4 comments

Comments

@denos
Copy link

denos commented Apr 20, 2012

Indexation fails with this message

Catalog URL Rewrites index process unknown error:
exception 'PDOException' with message 'SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'product/100053/4-1-1' for key 'UNQ_CORE_URL_REWRITE_ID_PATH_IS_SYSTEM_STORE_ID'' in /home/www/magento3/lib/Zend/Db/Statement/Pdo.php:228
Stack trace:
#0 /home/www/magento3/lib/Zend/Db/Statement/Pdo.php(228): PDOStatement->execute(Array)
#1 /home/www/magento3/lib/Varien/Db/Statement/Pdo/Mysql.php(110): Zend_Db_Statement_Pdo->_execute(Array)
#2 /home/www/magento3/lib/Zend/Db/Statement.php(300): Varien_Db_Statement_Pdo_Mysql->_execute(Array)
#3 /home/www/magento3/lib/Zend/Db/Adapter/Abstract.php(479): Zend_Db_Statement->execute(Array)
#4 /home/www/magento3/lib/Zend/Db/Adapter/Pdo/Abstract.php(238): Zend_Db_Adapter_Abstract->query('INSERT INTO co...', Array) #5 /home/www/magento3/lib/Varien/Db/Adapter/Pdo/Mysql.php(389): Zend_Db_Adapter_Pdo_Abstract->query('INSERT INTO co...', Array)
#6 /home/www/magento3/app/code/community/EcomDev/UrlRewrite/Model/Mysql4/Indexer.php(2040): Varien_Db_Adapter_Pdo_Mysql->query('INSERT INTO `co...')
#7 /home/www/magento3/app/code/community/EcomDev/UrlRewrite/Model/Mysql4/Indexer.php(2164): EcomDev_UrlRewrite_Model_Mysql4_Indexer->_updateRewrites()
#8 /home/www/magento3/app/code/community/EcomDev/UrlRewrite/Model/Indexer.php(97): EcomDev_UrlRewrite_Model_Mysql4_Indexer->reindexAll()
#9 /home/www/magento3/app/code/core/Mage/Index/Model/Process.php(207): EcomDev_UrlRewrite_Model_Indexer->reindexAll()
#10 /home/www/magento3/app/code/core/Mage/Index/Model/Process.php(253): Mage_Index_Model_Process->reindexAll()
#11 /home/www/magento3/shell/indexer.php(158): Mage_Index_Model_Process->reindexEverything()
#12 /home/www/magento3/shell/indexer.php(198): Mage_Shell_Compiler->run()
#13 {main}

Next exception 'Zend_Db_Statement_Exception' with message 'SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'product/100053/4-1-1' for key 'UNQ_CORE_URL_REWRITE_ID_PATH_IS_SYSTEM_STORE_ID'' in /home/www/magento3/lib/Zend/Db/Statement/Pdo.php:234
Stack trace:
#0 /home/www/magento3/lib/Varien/Db/Statement/Pdo/Mysql.php(110): Zend_Db_Statement_Pdo->_execute(Array)
#1 /home/www/magento3/lib/Zend/Db/Statement.php(300): Varien_Db_Statement_Pdo_Mysql->_execute(Array)
#2 /home/www/magento3/lib/Zend/Db/Adapter/Abstract.php(479): Zend_Db_Statement->execute(Array)
#3 /home/www/magento3/lib/Zend/Db/Adapter/Pdo/Abstract.php(238): Zend_Db_Adapter_Abstract->query('INSERT INTO co...', Array) #4 /home/www/magento3/lib/Varien/Db/Adapter/Pdo/Mysql.php(389): Zend_Db_Adapter_Pdo_Abstract->query('INSERT INTO co...', Array)
#5 /home/www/magento3/app/code/community/EcomDev/UrlRewrite/Model/Mysql4/Indexer.php(2040): Varien_Db_Adapter_Pdo_Mysql->query('INSERT INTO `co...')
#6 /home/www/magento3/app/code/community/EcomDev/UrlRewrite/Model/Mysql4/Indexer.php(2164): EcomDev_UrlRewrite_Model_Mysql4_Indexer->_updateRewrites()
#7 /home/www/magento3/app/code/community/EcomDev/UrlRewrite/Model/Indexer.php(97): EcomDev_UrlRewrite_Model_Mysql4_Indexer->reindexAll()
#8 /home/www/magento3/app/code/core/Mage/Index/Model/Process.php(207): EcomDev_UrlRewrite_Model_Indexer->reindexAll()
#9 /home/www/magento3/app/code/core/Mage/Index/Model/Process.php(253): Mage_Index_Model_Process->reindexAll()
#10 /home/www/magento3/shell/indexer.php(158): Mage_Index_Model_Process->reindexEverything()
#11 /home/www/magento3/shell/indexer.php(198): Mage_Shell_Compiler->run()
#12 {main}

Magento 1.6.2 with 200k products

@IvanChepurnyi
Copy link
Member

The issue is in incorrect rewrite values you have in Magento. Please make sure that your custom rewrites do not have the same id path and system rewrites for now. The issue with not allowing this rewrites to be inserted in our table will be resolved in the next version.

@paales
Copy link

paales commented Dec 12, 2012

Please make sure that your custom rewrites do not have the same id path and system rewrites for now. The issue with not allowing this rewrites to be inserted in our table will be resolved in the next version.

I'm not doing custom rewrites at the moment but still got the following error:

Integrity constraint violation: 1062 Duplicate entry 'product/100/3-1-1' for key 'UNQ_CORE_URL_REWRITE_ID_PATH_IS_SYSTEM_STORE_ID'' in lib/Zend/Db/Statement/Pdo.php:228

Can this also be due to duplicate URL keys? There are some products that have duplicate URL keys.

@paales
Copy link

paales commented Dec 13, 2012

After clearing the core_url_rewrite table, everything worked as expected. Thanks for the module and your hard work on it, you saved the day (week probably)!

@ScreamingDev
Copy link

Same here but without setting rewrites.

My fixture:

eav:
  catalog_category:
    - entity_id: 21
      parent_id: 2
      path: 1/2/21
      name: Common
      level: 2
      children_count: 0
      is_active: 1
      /stores:
        1:
          name: Common

After the test that uses this UnitTest always breaks with the Integrity constraint violation.

    /**
     * Tests EveryProductHasSpecialLinksToManage.
     *
     * @loadFixture eav_catalog_category
     *
     * @registry    current_category
     * @registry    category
     */
    public function testEveryCategoryHasSpecialLinksToManage() {
        $this->dispatch('catalog/category/view', array('id' => 21));
    }

I see nothing wrong with the fixture neither with my test.
core_url_rewrite is empty before and after running the test suite.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants