title: Magento: Column not found: 1054 Unknown column 'e.display_price_group_0' after rebuilding flat catalog product
body: <p>In magento, after rebuilding programmatically the flat product catalog with the script I found at <a href="http://www.magentocommerce.com/boards/viewthread/43238/" rel="nofollow">http://www.magentocommerce.com/boards/viewthread/43238/</a> I keep getting the error <code>exception 'Zend_Db_Statement_Exception' with message 'SQLSTATE[42S22]: Column not found: 1054 Unknown column 'e.display_price_group_0' in 'field list''</code> whenever I try to update a product's properties.</p>
  
  <p>Even more strange, I checked on other installations of Magento and there seem to be no column "display_price_group_0" in the table <code>catalog_product_flat_1</code>...</p>
  
  <p>Does anybody have a hint as to what is happening? What is the correct way to programmatically rebuild the flat catalog? Thank you a lot!</p>
  
  <pre><code>&lt;?php 
  
  // Carico l'enviroment dell'istallazione di Magento per sfruttare i suoi Model 
  require_once('..'.DIRECTORY_SEPARATOR.'app'.DIRECTORY_SEPARATOR.'Mage.php');
  Mage::app();
  
  // Inizializzo il file di log                  
  $logFileName = 'clear_cache.log';
  Mage::log("Inizio pulizia cache",null,$logFileName); 
  
  try {
    Mage::getSingleton('catalog/url')-&gt;refreshRewrites();
    Mage::log("[INFO] Catalog rewrites e' stato aggiornato con successo",null,$logFileName);
  } catch (Exception $e) {
    Mage::log("[ERRORE] " . $e,null,$logFileName);
  }
  try {
    Mage::getSingleton('catalog/index')-&gt;rebuild();
    Mage::log("Catalog Index e' stato aggiornato con successo",null,$logFileName);
  } catch (Exception $e) {
    Mage::log("[ERRORE] " . $e,null,$logFileName);
  }
  try {
    $flag = Mage::getModel('catalogindex/catalog_index_flag')-&gt;loadSelf();
    if ($flag-&gt;getState() == Mage_CatalogIndex_Model_Catalog_Index_Flag::STATE_RUNNING){
      $kill = Mage::getModel('catalogindex/catalog_index_kill_flag')-&gt;loadSelf();
      $kill-&gt;setFlagData($flag-&gt;getFlagData())-&gt;save();
    } 
    $flag-&gt;setState(Mage_CatalogIndex_Model_Catalog_Index_Flag::STATE_QUEUED)-&gt;save();
    Mage::getSingleton('catalogindex/indexer')-&gt;plainReindex();
    Mage::log("[INFO] Layered Navigation Indices e' stato aggiornato con successo",null,$logFileName);
  } catch (Exception $e) {
    Mage::log("[ERRORE] " . $e,null,$logFileName);
  }
  try {
    Mage::getModel('catalog/product_image')-&gt;clearCache();
    Mage::log("[INFO] Image cache e' stato aggiornato con successo",null,$logFileName);
  } catch (Exception $e) {
    Mage::log("[ERRORE] " . $e,null,$logFileName);
  }
  try {
    Mage::getSingleton('catalogsearch/fulltext')-&gt;rebuildIndex();
    Mage::log("[INFO] Search Index e' stato aggiornato con successo",null,$logFileName);
  } catch (Exception $e) {
    Mage::log("[ERRORE] " . $e,null,$logFileName);
  }
  try {
    Mage::getSingleton('cataloginventory/stock_status')-&gt;rebuild();
    Mage::log("[INFO] CatalogInventory Stock Status e' stato aggiornato con successo",null,$logFileName);
  } catch (Exception $e) {
    Mage::log("[ERRORE] " . $e,null,$logFileName);
  }
  try {
    Mage::getResourceModel('catalog/category_flat')-&gt;rebuild();
    Mage::log("[INFO] Flat Catalog Category e' stato aggiornato con successo",null,$logFileName);
  } catch (Exception $e) {
    Mage::log("[ERRORE] " . $e,null,$logFileName);
  }
  try {
    Mage::getResourceModel('catalog/product_flat_indexer')-&gt;rebuild();
    Mage::log("[INFO] Flat Catalog Product e' stato aggiornato con successo",null,$logFileName);  
  } catch (Exception $e) {
    Mage::log("[ERRORE] " . $e,null,$logFileName);
  }
  
  Mage::log("Fine pulizia cache",null,$logFileName);  
  ?&gt;
  </code></pre>