I am encountering the following issue after migrating the Magento 1.9.0.1 website to a new server.
I am using a php script that I run using ssh which fetches all the products from database and create a csv. it worked fine on the original site but it throws error on the new server. Below is the error trace printed by magento.
a:4:{i:0;s:1793636:"SELECT `t_d`.`entity_id`, `t_d`.`attribute_id`, `t_d`.`value` AS `default_value`, `t_s`.`value` AS `store_value`, IF(t_s.value_id IS NULL, t_d.value, t_s.value) AS `value` FROM `catalog_product_entity_int` AS `t_d`
LEFT JOIN `catalog_product_entity_int` AS `t_s` ON t_s.attribute_id = t_d.attribute_id AND t_s.entity_id = t_d.entity_id AND t_s.store_id = 1 WHERE (t_d.entity_type_id = 4) AND (t_d.entity_id IN (1, 2, 3, 4, 5, 6, 7, 8, 9, 10 )) AND (t_d.attribute_id IN ('92', '145', '100', '131', '128', '81', '89', '123', '126', '127', '124', '96', '121', '102', '125')) AND (t_d.store_id = 0) UNION ALL SELECT `t_d`.`entity_id`, `t_d`.`attribute_id`, `t_d`.`value` AS `default_value`, `t_s`.`value` AS `store_value`, IF(t_s.value_id IS NULL, t_d.value, t_s.value) AS `value` FROM `catalog_product_entity_decimal` AS `t_d`
LEFT JOIN `catalog_product_entity_decimal` AS `t_s` ON t_s.attribute_id = t_d.attribute_id AND t_s.entity_id = t_d.entity_id AND t_s.store_id = 1 WHERE (t_d.entity_type_id = 4) AND (t_d.entity_id IN (1, 2, 3, 4, 5, 6, 7, 8, 9, 10)) AND (t_d.attribute_id IN ('79', '90', '99', '120', '75', '76', '91', '80')) AND (t_d.store_id = 0) UNION ALL SELECT `t_d`.`entity_id`, `t_d`.`attribute_id`, `t_d`.`value` AS `default_value`, `t_s`.`value` AS `store_value`, IF(t_s.value_id IS NULL, t_d.value, t_s.value) AS `value` FROM `catalog_product_entity_varchar` AS `t_d`
LEFT JOIN `catalog_product_entity_varchar` AS `t_s` ON t_s.attribute_id = t_d.attribute_id AND t_s.entity_id = t_d.entity_id AND t_s.store_id = 1 WHERE (t_d.entity_type_id = 4) AND (t_d.entity_id IN (1, 2, 3, 4, 5, 6, 7, 8, 9, 10 )) AND (t_d.attribute_id IN ('117', '103', '133', '95', '122', '85', '112', '130', '88', '84', '82', '119', '118', '71', '109', '107', '137', '150', '149', '129', '86', '113', '138', '139', '140', '141', '142', '87', '114', '97', '98')) AND (t_d.store_id = 0) UNION ALL SELECT `t_d`.`entity_id`, `t_d`.`attribute_id`, `t_d`.`value` AS `default_value`, `t_s`.`value` AS `store_value`, IF(t_s.value_id IS NULL, t_d.value, t_s.value) AS `value` FROM `catalog_product_entity_datetime` AS `t_d`
LEFT JOIN `catalog_product_entity_datetime` AS `t_s` ON t_s.attribute_id = t_d.attribute_id AND t_s.entity_id = t_d.entity_id AND t_s.store_id = 1 WHERE (t_d.entity_type_id = 4) AND (t_d.entity_id IN (1, 2, 3, 4, 5, 6, 7, 8, 9, 10)) AND (t_d.attribute_id IN ('104', '105', '93', '94', '77', '78')) AND (t_d.store_id = 0) UNION ALL SELECT `t_d`.`entity_id`, `t_d`.`attribute_id`, `t_d`.`value` AS `default_value`, `t_s`.`value` AS `store_value`, IF(t_s.value_id IS NULL, t_d.value, t_s.value) AS `value` FROM `catalog_product_entity_text` AS `t_d`
LEFT JOIN `catalog_product_entity_text` AS `t_s` ON t_s.attribute_id = t_d.attribute_id AND t_s.entity_id = t_d.entity_id AND t_s.store_id = 1 WHERE (t_d.entity_type_id = 4) AND (t_d.entity_id IN (1, 2, 3, 4, 5, 6, 7, 8, 9, 10)) AND (t_d.attribute_id IN ('106', '72', '83', '146', '101', '135', '148', '73', '136', '134')) AND (t_d.store_id = 0)";i:1;s:1229:"
#0 /var/www/html/lib/Varien/Db/Statement/Pdo/Mysql.php(110): Zend_Db_Statement_Pdo->_execute(Array)
#1 /var/www/html/app/code/core/Zend/Db/Statement.php(291): Varien_Db_Statement_Pdo_Mysql->_execute(Array)
#2 /var/www/html/lib/Zend/Db/Adapter/Abstract.php(480): Zend_Db_Statement->execute(Array)
#3 /var/www/html/lib/Zend/Db/Adapter/Pdo/Abstract.php(238): Zend_Db_Adapter_Abstract->query('SELECT `t_d`.`e...', Array)
#4 /var/www/html/lib/Varien/Db/Adapter/Pdo/Mysql.php(428): Zend_Db_Adapter_Pdo_Abstract->query('SELECT `t_d`.`e...', Array)
#5 /var/www/html/lib/Zend/Db/Adapter/Abstract.php(737): Varien_Db_Adapter_Pdo_Mysql->query('SELECT `t_d`.`e...', Array)
#6 /var/www/html/app/code/core/Mage/Eav/Model/Entity/Collection/Abstract.php(1111): Zend_Db_Adapter_Abstract->fetchAll('SELECT `t_d`.`e...')
#7 /var/www/html/app/code/core/Mage/Catalog/Model/Resource/Product/Collection.php(480): Mage_Eav_Model_Entity_Collection_Abstract->_loadAttributes(false, false)
#8 /var/www/html/app/code/core/Mage/Eav/Model/Entity/Collection/Abstract.php(874): Mage_Catalog_Model_Resource_Product_Collection->_loadAttributes(false, false)
#9 /var/www/html/shell/exporter-new.php(70): Mage_Eav_Model_Entity_Collection_Abstract->load()
#10 {main}
The code that is throwing this error is this:
$products = Mage::getModel("catalog/product")
->getCollection()
->addAttributeToSort('created_at', 'DESC')
->addAttributeToSelect('*')
->load();
I couldn't figure out what the issue is. Any suggestions ?