Try the Demo

Magento Forum

   
SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry
 
kkoz
Jr. Member
 
Total Posts:  14
Joined:  2011-12-20
 

Hello,

We are running Magento CE 1.7
A few days ago we added some new categories and this morning all of a sudden we got this error on our site. I read through a lot of posts and cleared the log tables which seemed to work; however, i would like to find a more permanent solution.

Has anyone been able to fix this at the root of the problem?

Thank you!

“SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry ‘40’ for key ‘PRIMARY‘“;i:1;s:3003:"#0 /home/store/public_html/lib/Varien/Db/Statement/Pdo/Mysql.php(110): Zend_Db_Statement_Pdo->_execute(Array)
#1 /home/store/public_html/lib/Zend/Db/Statement.php(300): Varien_Db_Statement_Pdo_Mysql->_execute(Array)
#2 /home/store/public_html/lib/Zend/Db/Adapter/Abstract.php(479): Zend_Db_Statement->execute(Array)
#3 /home/store/public_html/lib/Zend/Db/Adapter/Pdo/Abstract.php(238): Zend_Db_Adapter_Abstract->query(’INSERT INTO `lo...’, Array)
#4 /home/store/public_html/lib/Varien/Db/Adapter/Pdo/Mysql.php(419): Zend_Db_Adapter_Pdo_Abstract->query(’INSERT INTO `lo...’, Array)
#5 /home/store/public_html/lib/Zend/Db/Adapter/Abstract.php(574): Varien_Db_Adapter_Pdo_Mysql->query(’INSERT INTO `lo...’, Array)
#6 /home/store/public_html/app/code/core/Mage/Log/Model/Resource/Visitor.php(174): Zend_Db_Adapter_Abstract->insert(’log_visitor_inf...’, Array)
#7 /home/store/public_html/app/code/core/Mage/Log/Model/Resource/Visitor.php(108): Mage_Log_Model_Resource_Visitor->_saveVisitorInfo(Object(Fooman_Jirafe_Model_Log_Visitor))
#8 /home/store/public_html/app/code/core/Mage/Core/Model/Resource/Db/Abstract.php(463): Mage_Log_Model_Resource_Visitor->_afterSave(Object(Fooman_Jirafe_Model_Log_Visitor))
#9 /home/store/public_html/app/code/core/Mage/Core/Model/Abstract.php(318): Mage_Core_Model_Resource_Db_Abstract->save(Object(Fooman_Jirafe_Model_Log_Visitor))
#10 /home/store/public_html/app/code/core/Mage/Log/Model/Visitor.php(167): Mage_Core_Model_Abstract->save()
#11 /home/store/public_html/app/code/core/Mage/Core/Model/App.php(1338): Mage_Log_Model_Visitor->initByRequest(Object(Varien_Event_Observer))
#12 /home/store/public_html/app/code/core/Mage/Core/Model/App.php(1317): Mage_Core_Model_App->_callObserverMethod(Object(Fooman_Jirafe_Model_Log_Visitor), ‘initByRequest’, Object(Varien_Event_Observer))
#13 /home/store/public_html/app/Mage.php(447): Mage_Core_Model_App->dispatchEvent(’controller_acti...’, Array)
#14 /home/store/public_html/app/code/core/Mage/Core/Controller/Varien/Action.php(528): Mage::dispatchEvent(’controller_acti...’, Array)
#15 /home/store/public_html/app/code/core/Mage/Core/Controller/Front/Action.php(64): Mage_Core_Controller_Varien_Action->preDispatch()
#16 /home/store/public_html/app/code/core/Mage/Core/Controller/Varien/Action.php(408): Mage_Core_Controller_Front_Action->preDispatch()
#17 /home/store/public_html/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(250): Mage_Core_Controller_Varien_Action->dispatch(’index’)
#18 /home/store/public_html/app/code/core/Mage/Core/Controller/Varien/Front.php(176): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
#19 /home/store/public_html/app/code/core/Mage/Core/Model/App.php(354): Mage_Core_Controller_Varien_Front->dispatch()
#20 /home/store/public_html/app/Mage.php(683): Mage_Core_Model_App->run(Array)
#21 /home/store/public_html/index.php(87): Mage::run(’’, ‘store’)
#22 {main}”;s:3:"url”;s:1:"/”;s:11:"script_name”;s:10:"/index.php”;s:4:"skin”;s:6:"store";}

 
Magento Community Magento Community
Magento Community
Magento Community
 
mahmudbd
Member
 
Total Posts:  42
Joined:  2010-02-19
Dhaka
 

I think .. before you create the categories.. you did not reindex your store.. that’s why you are getting this problem.. can you also post a screen shot of the error?
Thanks

 Signature 

Hire Me! http://www.magentothemecoder.com

 
Magento Community Magento Community
Magento Community
Magento Community
 
kkoz
Jr. Member
 
Total Posts:  14
Joined:  2011-12-20
 
mahmudbd - 14 November 2012 09:43 AM

I think .. before you create the categories.. you did not reindex your store.. that’s why you are getting this problem.. can you also post a screen shot of the error?
Thanks

You are right, i did not reindex before adding the new categories. But, would that really trigger the error?
I don’t have the screenshot because i fixed it and i don’t want to brake it again. It was a usual Magento error page with Magento’s default colors.

 
Magento Community Magento Community
Magento Community
Magento Community
 
mahmudbd
Member
 
Total Posts:  42
Joined:  2010-02-19
Dhaka
 

That’s great you solve the problem. yeah it’s a best practice always reindex after create any category or products. It will also help you to run the store smoothly.

 Signature 

Hire Me! http://www.magentothemecoder.com

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
    Back to top