title: Magento Duplicate entry in `catalog_product_entity_tier_price` error on product save
body: <p>I have a product with <code>Tier Price</code> enabled. When I load that product and try to update, Magento throws exception. </p>
  
  <p>Here is my code.</p>
  
  <pre><code>$_product = Mage::getModel('catalog/product')-&gt;load(779);
  try {
      $_product-&gt;setData('backorder_limit', '10');
      $_product-&gt;save();
  } catch (Exception $e) {
      echo $e-&gt;getMessage();
  }
  </code></pre>
  
  <p>Above code prints below exception</p>
  
  <blockquote>
    <p>SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry
    '779-1-0-5.0000-0' for key 'E8AB433B9ACB00343ABB312AD2FAB087', query
    was: INSERT INTO <code>catalog_product_entity_tier_price</code> (<code>entity_id</code>,
    <code>all_groups</code>, <code>customer_group_id</code>, <code>qty</code>, <code>value</code>, <code>website_id</code>)
    VALUES (?, ?, ?, ?, ?, ?)</p>
  </blockquote>
  
  <p>When I remove Tier Price, above code works fine. I tried reindexing and cleared Cache but no success.</p>
  
  <p>I am clueless about the error, so I am here to ask you guys if someone know what is the issue and how to fix it?</p>
  
  <p>Thanks a lot !</p>