Marceli Po
Marceli Po

Reputation: 743

When trying to reindex catalog_product_flat I'm getting unknown error

I'm trying to reindex catalog_product_flat and I'm getting this error:

Product Flat Data index process unknown error:
exception 'PDOException' with message 'SQLSTATE[42000]: Syntax error or access violation: 1118 Row size too large. The maximum row size for the used table type, not counting BLOBs, is 65535. You have to change some columns to TEXT or BLOBs' in /path/to/magento/lib/Zend/Db/Statement/Pdo.php:228
Stack trace:
#0 /path/to/magento/lib/Zend/Db/Statement/Pdo.php(228): PDOStatement->execute(Array)
#1 /path/to/magento/lib/Varien/Db/Statement/Pdo/Mysql.php(110): Zend_Db_Statement_Pdo->_execute(Array)
#2 /path/to/magento/lib/Zend/Db/Statement.php(320): Varien_Db_Statement_Pdo_Mysql->_execute(Array)
#3 /path/to/magento/lib/Zend/Db/Adapter/Abstract.php(479): Zend_Db_Statement->execute(Array)
#4 /path/to/magento/lib/Zend/Db/Adapter/Pdo/Abstract.php(238): Zend_Db_Adapter_Abstract->query('ALTER TABLE `ma...', Array)
#5 /path/to/magento/lib/Varien/Db/Adapter/Pdo/Mysql.php(419): Zend_Db_Adapter_Pdo_Abstract->query('ALTER TABLE `ma...', Array)
#6 /path/to/magento/lib/Varien/Db/Adapter/Pdo/Mysql.php(340): Varien_Db_Adapter_Pdo_Mysql->query('ALTER TABLE `ma...')
#7 /path/to/magento/lib/Varien/Db/Adapter/Pdo/Mysql.php(839): Varien_Db_Adapter_Pdo_Mysql->raw_query('ALTER TABLE `ma...')
#8 /path/to/magento/app/code/core/Mage/Catalog/Model/Resource/Product/Flat/Indexer.php(799): Varien_Db_Adapter_Pdo_Mysql->addColumn('mage_catalog_pr...', 'email_template', Array)
#9 /path/to/magento/app/code/core/Mage/Catalog/Model/Resource/Product/Flat/Indexer.php(1390): Mage_Catalog_Model_Resource_Product_Flat_Indexer->prepareFlatTable(1)
#10 /path/to/magento/app/code/core/Mage/Catalog/Model/Product/Flat/Indexer.php(296): Mage_Catalog_Model_Resource_Product_Flat_Indexer->reindexAll()
#11 /path/to/magento/app/code/core/Mage/Catalog/Model/Product/Indexer/Flat.php(336): Mage_Catalog_Model_Product_Flat_Indexer->reindexAll()
#12 /path/to/magento/app/code/core/Mage/Index/Model/Process.php(209): Mage_Catalog_Model_Product_Indexer_Flat->reindexAll()
#13 /path/to/magento/app/code/core/Mage/Index/Model/Process.php(255): Mage_Index_Model_Process->reindexAll()
#14 /path/to/magento/shell/indexer.php(158): Mage_Index_Model_Process->reindexEverything()
#15 /path/to/magento/shell/indexer.php(198): Mage_Shell_Compiler->run()
#16 {main}

Reindex is done on magento enterprise 1.12 on data taken from magento 1.3.4 community. It's happens while doing reindex from admin or shell indexer.

Upvotes: 1

Views: 1584

Answers (3)

parhamr
parhamr

Reputation: 597

This answer addresses the underlying problem of attribute count without resorting to schema or code modifications.

Upvotes: 1

krishna singh
krishna singh

Reputation: 1073

magento programmatically reindex

ID Code

1 catalog_product_attribute

2 catalog_product_price

3 catalog_url

4 catalog_product_flat

5 catalog_category_flat

6 catalog_category_product

7 catalogsearch_stock

8 cataloginventory_stock

9 tag_summary

complete re index

for ($i = 1; $i <= 9; $i++) {

$process = Mage::getModel('index/process')->load($i);

$process->reindexAll();

} individual reindex

$process = Mage::getModel('index/process')->load(4);

$process->reindexAll();

Upvotes: 0

Marceli Po
Marceli Po

Reputation: 743

Ok I found solution I had to change in /path/to/magento/app/code/core/Mage/Eav/Model/Entity/Attribute/Abstract.php in method _getFlatColumnsOldDefinition this code:

case 'varchar':
    $columns[$this->getAttributeCode()] = array(
        'type' => 'varchar(255)'

To this one:

case 'varchar':
    $columns[$this->getAttributeCode()] = array(
        'type' => 'text'

Upvotes: 3

Related Questions