Try the Demo

Magento Forum

   
foreign key error
 
gnum
Member
 
Total Posts:  38
Joined:  2009-02-16
 

From time to time i am getting error when pressing order button in cart:

SQLSTATE[HY000]: General error: 1451 Cannot delete or update a parent row: a foreign key constraint fails (`gifts/sales_flat_quote_shipping_rate`, CONSTRAINT `FK_SALES_QUOTE_SHIPPING_RATE_ADDRESS` FOREIGN KEY (`address_id`) REFERENCES `sales_flat_quote_address` (`address_id`))
Trace:
#0 D:\www\gifts\lib\Zend\Db\Statement.php(283): Zend_Db_Statement_Pdo->_execute(Array)
#1 D:\www\gifts\lib\Zend\Db\Adapter\Abstract.php(457): Zend_Db_Statement->execute(Array)
#2 D:\www\gifts\lib\Zend\Db\Adapter\Pdo\Abstract.php(230): Zend_Db_Adapter_Abstract->query(’DELETE FROM `sa...’, Array)
#3 D:\www\gifts\lib\Varien\Db\Adapter\Pdo\Mysql.php(258): Zend_Db_Adapter_Pdo_Abstract->query(’DELETE FROM `sa...’, Array)
#4 D:\www\gifts\lib\Zend\Db\Adapter\Abstract.php(604): Varien_Db_Adapter_Pdo_Mysql->query(’DELETE FROM `sa...’)
#5 D:\www\gifts\app\code\core\Mage\Core\Model\Mysql4\Abstract.php(370): Zend_Db_Adapter_Abstract->delete(’sales_flat_quot...’, ‘address_id=’42’’)
#6 D:\www\gifts\app\code\core\Mage\Core\Model\Mysql4\Abstract.php(339): Mage_Core_Model_Mysql4_Abstract->delete(Object(Mage_Sales_Model_Quote_Address))
#7 D:\www\gifts\app\code\core\Mage\Core\Model\Abstract.php(251): Mage_Core_Model_Mysql4_Abstract->save(Object(Mage_Sales_Model_Quote_Address))
#8 D:\www\gifts\app\code\core\Mage\Core\Model\Mysql4\Collection\Abstract.php(206): Mage_Core_Model_Abstract->save()
#9 D:\www\gifts\app\code\core\Mage\Sales\Model\Quote.php(203): Mage_Core_Model_Mysql4_Collection_Abstract->save()
#10 D:\www\gifts\app\code\core\Mage\Core\Model\Abstract.php(252): Mage_Sales_Model_Quote->_afterSave()
#11 D:\www\gifts\app\code\core\Mage\Checkout\Model\Cart.php(338): Mage_Core_Model_Abstract->save()
#12 D:\www\gifts\app\code\core\Mage\Checkout\controllers\CartController.php(110): Mage_Checkout_Model_Cart->save()
#13 D:\www\gifts\app\code\core\Mage\Core\Controller\Varien\Action.php(367): Mage_Checkout_CartController->indexAction()
#14 D:\www\gifts\app\code\core\Mage\Core\Controller\Varien\Router\Standard.php(163): Mage_Core_Controller_Varien_Action->dispatch(’index’)
#15 D:\www\gifts\app\code\core\Mage\Core\Controller\Varien\Front.php(158): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
#16 D:\www\gifts\app\Mage.php(457): Mage_Core_Controller_Varien_Front->dispatch()
#17 D:\www\gifts\index.php(52): Mage::run()
#18 {main}

Looks like Magento tryed to clear some order cache or something like this.

Can someone advice?

 Signature 

Custom software development

 
Magento Community Magento Community
Magento Community
Magento Community
 
rainman127
Sr. Member
 
Avatar
Total Posts:  218
Joined:  2008-06-30
 

Hi,
Is your mySql database using the InnoDB engine?

 Signature 

A full integration of WordPress on the Magento platform
MagePress

 
Magento Community Magento Community
Magento Community
Magento Community
 
gnum
Member
 
Total Posts:  38
Joined:  2009-02-16
 

hi,
rainman127, yes

 Signature 

Custom software development

 
Magento Community Magento Community
Magento Community
Magento Community
 
rainman127
Sr. Member
 
Avatar
Total Posts:  218
Joined:  2008-06-30
 

Ok, so lets do the logic on this:

have you added any modules to the default install? shipping module maybe?
It only does it some of the time. when it happens look at the customer address.
See anything in common when it fails?

just some thoughts..

thanks

 Signature 

A full integration of WordPress on the Magento platform
MagePress

 
Magento Community Magento Community
Magento Community
Magento Community
 
mrmiagi
Jr. Member
 
Total Posts:  8
Joined:  2009-03-26
 
gnum - 23 March 2009 09:38 AM

From time to time i am getting error when pressing order button in cart:


SQLSTATE[HY000]: General error: 1451 Cannot delete or update a parent row: a foreign key constraint fails (`gifts/sales_flat_quote_shipping_rate`, CONSTRAINT `FK_SALES_QUOTE_SHIPPING_RATE_ADDRESS` FOREIGN KEY (`address_id`) REFERENCES `sales_flat_quote_address` (`address_id`))
Trace:
#0 D:\www\gifts\lib\Zend\Db\Statement.php(283): Zend_Db_Statement_Pdo->_execute(Array)
#1 D:\www\gifts\lib\Zend\Db\Adapter\Abstract.php(457): Zend_Db_Statement->execute(Array)
#2 D:\www\gifts\lib\Zend\Db\Adapter\Pdo\Abstract.php(230): Zend_Db_Adapter_Abstract->query(’DELETE FROM `sa...’, Array)
#3 D:\www\gifts\lib\Varien\Db\Adapter\Pdo\Mysql.php(258): Zend_Db_Adapter_Pdo_Abstract->query(’DELETE FROM `sa...’, Array)
#4 D:\www\gifts\lib\Zend\Db\Adapter\Abstract.php(604): Varien_Db_Adapter_Pdo_Mysql->query(’DELETE FROM `sa...’)
#5 D:\www\gifts\app\code\core\Mage\Core\Model\Mysql4\Abstract.php(370): Zend_Db_Adapter_Abstract->delete(’sales_flat_quot...’, ‘address_id=’42’’)
#6 D:\www\gifts\app\code\core\Mage\Core\Model\Mysql4\Abstract.php(339): Mage_Core_Model_Mysql4_Abstract->delete(Object(Mage_Sales_Model_Quote_Address))
#7 D:\www\gifts\app\code\core\Mage\Core\Model\Abstract.php(251): Mage_Core_Model_Mysql4_Abstract->save(Object(Mage_Sales_Model_Quote_Address))
#8 D:\www\gifts\app\code\core\Mage\Core\Model\Mysql4\Collection\Abstract.php(206): Mage_Core_Model_Abstract->save()
#9 D:\www\gifts\app\code\core\Mage\Sales\Model\Quote.php(203): Mage_Core_Model_Mysql4_Collection_Abstract->save()
#10 D:\www\gifts\app\code\core\Mage\Core\Model\Abstract.php(252): Mage_Sales_Model_Quote->_afterSave()
#11 D:\www\gifts\app\code\core\Mage\Checkout\Model\Cart.php(338): Mage_Core_Model_Abstract->save()
#12 D:\www\gifts\app\code\core\Mage\Checkout\controllers\CartController.php(110): Mage_Checkout_Model_Cart->save()
#13 D:\www\gifts\app\code\core\Mage\Core\Controller\Varien\Action.php(367): Mage_Checkout_CartController->indexAction()
#14 D:\www\gifts\app\code\core\Mage\Core\Controller\Varien\Router\Standard.php(163): Mage_Core_Controller_Varien_Action->dispatch(’index’)
#15 D:\www\gifts\app\code\core\Mage\Core\Controller\Varien\Front.php(158): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
#16 D:\www\gifts\app\Mage.php(457): Mage_Core_Controller_Varien_Front->dispatch()
#17 D:\www\gifts\index.php(52): Mage::run()
#18 {main}

Looks like Magento tryed to clear some order cache or something like this.

Can someone advice?

i get nearly the same error.
have you found a solution for that problem?

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