cancel
Showing results for 
Search instead for 
Did you mean: 

Can't create new product database error

Can't create new product database error

Hello everyone,

 

Recently I changed my website (Magento 2.1.9) to production mode, and now I'm getting this error when I try to create a new product:

SQLSTATE[42S22]: Column not found: 1054 Unknown column 'e_attr.store_id' in 'field list', query was: SELECT `e_attr`.`store_id` FROM `catalog_product_entity` AS `e` INNER JOIN `catalog_product_entity` AS `e_attr` ON e.entity_id = e_attr.entity_id WHERE (e_attr.attribute_id = '') AND (e.entity_id = '2065')

I don't understand what's happening, the column is selecting don't exist on that table, I think the join is doing with the same table must be wrong or something. I give you the full exception trail:

Spoiler
Next Zend_Db_Statement_Exception: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'e_attr.store_id' in 'field list', query was: SELECT `e_attr`.`store_id` FROM `catalog_product_entity` AS `e`
 INNER JOIN `catalog_product_entity` AS `e_attr` ON e.entity_id = e_attr.entity_id WHERE (e_attr.attribute_id = '') AND (e.entity_id = '2064') in /var/www/vhosts/misskits.com/httpdocs/current/vendor/magento/zendframework1/library/Zend/Db/Statement/Pdo.php:235
Stack trace:
#0 /var/www/vhosts/misskits.com/httpdocs/current/vendor/magento/framework/DB/Statement/Pdo/Mysql.php(95): Zend_Db_Statement_Pdo->_execute(Array)
#1 /var/www/vhosts/misskits.com/httpdocs/current/vendor/magento/zendframework1/library/Zend/Db/Statement.php(323): Magento\Framework\DB\Statement\Pdo\Mysql->_execute(Array)
#2 /var/www/vhosts/misskits.com/httpdocs/current/vendor/magento/zendframework1/library/Zend/Db/Adapter/Abstract.php(480): Zend_Db_Statement->execute(Array)
#3 /var/www/vhosts/misskits.com/httpdocs/current/vendor/magento/zendframework1/library/Zend/Db/Adapter/Pdo/Abstract.php(238): Zend_Db_Adapter_Abstract->query('SELECT `e_attr`...', Array)
#4 /var/www/vhosts/misskits.com/httpdocs/current/vendor/magento/framework/DB/Adapter/Pdo/Mysql.php(465): Zend_Db_Adapter_Pdo_Abstract->query('SELECT `e_attr`...', Array)
#5 /var/www/vhosts/misskits.com/httpdocs/current/vendor/magento/framework/DB/Adapter/Pdo/Mysql.php(520): Magento\Framework\DB\Adapter\Pdo\Mysql->_query('SELECT `e_attr`...', Array)
#6 /var/www/vhosts/misskits.com/httpdocs/current/vendor/magento/zendframework1/library/Zend/Db/Adapter/Abstract.php(794): Magento\Framework\DB\Adapter\Pdo\Mysql->query(Object(Magento\Framework\DB\Select), Array)
#7 /var/www/vhosts/misskits.com/httpdocs/current/vendor/magento/module-catalog-url-rewrite/Service/V1/StoreViewService.php(102): Zend_Db_Adapter_Abstract->fetchCol(Object(Magento\Framework\DB\Select))
#8 /var/www/vhosts/misskits.com/httpdocs/current/vendor/magento/module-catalog-url-rewrite/Service/V1/StoreViewService.php(56): Magento\CatalogUrlRewrite\Service\V1\StoreViewService->doesEntityHaveOverriddenUrlAttributeForStore('1', '2064', 'catalog_product', 'url_key')
#9 /var/www/vhosts/misskits.com/httpdocs/current/vendor/magento/module-catalog-url-rewrite/Model/ProductScopeRewriteGenerator.php(145): Magento\CatalogUrlRewrite\Service\V1\StoreViewService->doesEntityHaveOverriddenUrlKeyForStore('1', '2064', 'catalog_product')
#10 /var/www/vhosts/misskits.com/httpdocs/current/vendor/magento/module-catalog-url-rewrite/Model/ProductUrlRewriteGenerator.php(175): Magento\CatalogUrlRewrite\Model\ProductScopeRewriteGenerator->generateForGlobalScope(Object(Magento\Catalog\Model\ResourceModel\Category\Collection), Object(Magento\Catalog\Model\Product\Interceptor), NULL)
#11 /var/www/vhosts/misskits.com/httpdocs/current/vendor/magento/module-catalog-url-rewrite/Model/ProductUrlRewriteGenerator.php(143): Magento\CatalogUrlRewrite\Model\ProductUrlRewriteGenerator->generateForGlobalScope(Object(Magento\Catalog\Model\ResourceModel\Category\Collection), Object(Magento\Catalog\Model\Product\Interceptor), NULL)
#12 /var/www/vhosts/misskits.com/httpdocs/current/vendor/magento/module-catalog-url-rewrite/Observer/ProductProcessUrlRewriteSavingObserver.php(61): Magento\CatalogUrlRewrite\Model\ProductUrlRewriteGenerator->generate(Object(Magento\Catalog\Model\Product\Interceptor))
#13 /var/www/vhosts/misskits.com/httpdocs/current/vendor/magento/framework/Event/Invoker/InvokerDefault.php(73): Magento\CatalogUrlRewrite\Observer\ProductProcessUrlRewriteSavingObserver->execute(Object(Magento\Framework\Event\Observer))
#14 /var/www/vhosts/misskits.com/httpdocs/current/vendor/magento/framework/Event/Invoker/InvokerDefault.php(61): Magento\Framework\Event\Invoker\InvokerDefault->_callObserverMethod(Object(Magento\CatalogUrlRewrite\Observer\ProductProcessUrlRewriteSavingObserver), Object(Magento\Framework\Event\Observer))
#15 /var/www/vhosts/misskits.com/httpdocs/current/vendor/magento/framework/Event/Manager.php(66): Magento\Framework\Event\Invoker\InvokerDefault->dispatch(Array, Object(Magento\Framework\Event\Observer))
#16 /var/www/vhosts/misskits.com/httpdocs/current/var/generation/Magento/Framework/Event/Manager/Proxy.php(95): Magento\Framework\Event\Manager->dispatch('catalog_product...', Array)
#17 /var/www/vhosts/misskits.com/httpdocs/current/vendor/magento/framework/Model/AbstractModel.php(802): Magento\Framework\Event\Manager\Proxy->dispatch('catalog_product...', Array)
#18 /var/www/vhosts/misskits.com/httpdocs/current/vendor/magento/module-catalog/Model/Product.php(921): Magento\Framework\Model\AbstractModel->afterSave()
#19 /var/www/vhosts/misskits.com/httpdocs/current/var/generation/Magento/Catalog/Model/Product/Interceptor.php(362): Magento\Catalog\Model\Product->afterSave()
#20 /var/www/vhosts/misskits.com/httpdocs/current/vendor/magento/framework/EntityManager/Observer/AfterEntitySave.php(34): Magento\Catalog\Model\Product\Interceptor->afterSave()
#21 /var/www/vhosts/misskits.com/httpdocs/current/vendor/magento/framework/Event/Invoker/InvokerDefault.php(73): Magento\Framework\EntityManager\Observer\AfterEntitySave->execute(Object(Magento\Framework\Event\Observer))
#22 /var/www/vhosts/misskits.com/httpdocs/current/vendor/magento/framework/Event/Invoker/InvokerDefault.php(61): Magento\Framework\Event\Invoker\InvokerDefault->_callObserverMethod(Object(Magento\Framework\EntityManager\Observer\AfterEntitySave), Object(Magento\Framework\Event\Observer))
#23 /var/www/vhosts/misskits.com/httpdocs/current/vendor/magento/framework/Event/Manager.php(66): Magento\Framework\Event\Invoker\InvokerDefault->dispatch(Array, Object(Magento\Framework\Event\Observer))
#24 /var/www/vhosts/misskits.com/httpdocs/current/var/generation/Magento/Framework/Event/Manager/Proxy.php(95): Magento\Framework\Event\Manager->dispatch('magento_catalog...', Array)
#25 /var/www/vhosts/misskits.com/httpdocs/current/vendor/magento/framework/EntityManager/EventManager.php(52): Magento\Framework\Event\Manager\Proxy->dispatch('magento_catalog...', Array)
#26 /var/www/vhosts/misskits.com/httpdocs/current/vendor/magento/framework/EntityManager/Operation/Create.php(108): Magento\Framework\EntityManager\EventManager->dispatchEntityEvent('Magento\\Catalog...', 'save_after', Array)
#27 /var/www/vhosts/misskits.com/httpdocs/current/vendor/magento/framework/EntityManager/EntityManager.php(87): Magento\Framework\EntityManager\Operation\Create->execute(Object(Magento\Catalog\Model\Product\Interceptor), Array)
#28 /var/www/vhosts/misskits.com/httpdocs/current/vendor/magento/module-catalog/Model/ResourceModel/Product.php(695): Magento\Framework\EntityManager\EntityManager->save(Object(Magento\Catalog\Model\Product\Interceptor))
#29 /var/www/vhosts/misskits.com/httpdocs/current/vendor/magento/framework/Interception/Interceptor.php(74): Magento\Catalog\Model\ResourceModel\Product->save(Object(Magento\Catalog\Model\Product\Interceptor))
#30 /var/www/vhosts/misskits.com/httpdocs/current/vendor/magento/framework/Interception/Chain/Chain.php(70): Magento\Catalog\Model\ResourceModel\Product\Interceptor->___callParent('save', Array)
#31 /var/www/vhosts/misskits.com/httpdocs/current/vendor/magento/framework/Interception/Chain/Chain.php(63): Magento\Framework\Interception\Chain\Chain->invokeNext('Magento\\Catalog...', 'save', Object(Magento\Catalog\Model\ResourceModel\Product\Interceptor), Array, 'apply_catalog_r...')
#32 /var/www/vhosts/misskits.com/httpdocs/current/vendor/magento/module-catalog-rule/Plugin/Indexer/Product/Save/ApplyRules.php(40): Magento\Framework\Interception\Chain\Chain->Magento\Framework\Interception\Chain\{closure}(Object(Magento\Catalog\Model\Product\Interceptor))
#33 /var/www/vhosts/misskits.com/httpdocs/current/vendor/magento/framework/Interception/Chain/Chain.php(67): Magento\CatalogRule\Plugin\Indexer\Product\Save\ApplyRules->aroundSave(Object(Magento\Catalog\Model\ResourceModel\Product\Interceptor), Object(Closure), Object(Magento\Catalog\Model\Product\Interceptor))
#34 /var/www/vhosts/misskits.com/httpdocs/current/vendor/magento/framework/Interception/Chain/Chain.php(63): Magento\Framework\Interception\Chain\Chain->invokeNext('Magento\\Catalog...', 'save', Object(Magento\Catalog\Model\ResourceModel\Product\Interceptor), Array, 'catalogsearchFu...')
#35 /var/www/vhosts/misskits.com/httpdocs/current/vendor/magento/module-catalog-search/Model/Indexer/Fulltext/Plugin/Product.php(51): Magento\Framework\Interception\Chain\Chain->Magento\Framework\Interception\Chain\{closure}(Object(Magento\Catalog\Model\Product\Interceptor))
#36 /var/www/vhosts/misskits.com/httpdocs/current/vendor/magento/module-catalog-search/Model/Indexer/Fulltext/Plugin/Product.php(24): Magento\CatalogSearch\Model\Indexer\Fulltext\Plugin\Product->addCommitCallback(Object(Magento\Catalog\Model\ResourceModel\Product\Interceptor), Object(Closure), Object(Magento\Catalog\Model\Product\Interceptor))
#37 /var/www/vhosts/misskits.com/httpdocs/current/vendor/magento/framework/Interception/Chain/Chain.php(67): Magento\CatalogSearch\Model\Indexer\Fulltext\Plugin\Product->aroundSave(Object(Magento\Catalog\Model\ResourceModel\Product\Interceptor), Object(Closure), Object(Magento\Catalog\Model\Product\Interceptor))
#38 /var/www/vhosts/misskits.com/httpdocs/current/vendor/magento/framework/Interception/Interceptor.php(138): Magento\Framework\Interception\Chain\Chain->invokeNext('Magento\\Catalog...', 'save', Object(Magento\Catalog\Model\ResourceModel\Product\Interceptor), Array, 'clean_cache')
#39 /var/www/vhosts/misskits.com/httpdocs/current/vendor/magento/framework/App/Cache/FlushCacheByTags.php(71): Magento\Catalog\Model\ResourceModel\Product\Interceptor->Magento\Framework\Interception\{closure}(Object(Magento\Catalog\Model\Product\Interceptor))
#40 /var/www/vhosts/misskits.com/httpdocs/current/vendor/magento/framework/Interception/Interceptor.php(142): Magento\Framework\App\Cache\FlushCacheByTags->aroundSave(Object(Magento\Catalog\Model\ResourceModel\Product\Interceptor), Object(Closure), Object(Magento\Catalog\Model\Product\Interceptor))
#41 /var/www/vhosts/misskits.com/httpdocs/current/var/generation/Magento/Catalog/Model/ResourceModel/Product/Interceptor.php(273): Magento\Catalog\Model\ResourceModel\Product\Interceptor->___callPlugins('save', Array, Array)
#42 /var/www/vhosts/misskits.com/httpdocs/current/vendor/magento/framework/Model/AbstractModel.php(631): Magento\Catalog\Model\ResourceModel\Product\Interceptor->save(Object(Magento\Catalog\Model\Product\Interceptor))
#43 /var/www/vhosts/misskits.com/httpdocs/current/var/generation/Magento/Catalog/Model/Product/Interceptor.php(2364): Magento\Framework\Model\AbstractModel->save()
#44 /var/www/vhosts/misskits.com/httpdocs/current/vendor/magento/module-catalog/Controller/Adminhtml/Product/Save.php(110): Magento\Catalog\Model\Product\Interceptor->save()
#45 /var/www/vhosts/misskits.com/httpdocs/current/var/generation/Magento/Catalog/Controller/Adminhtml/Product/Save/Interceptor.php(24): Magento\Catalog\Controller\Adminhtml\Product\Save->execute()
#46 /var/www/vhosts/misskits.com/httpdocs/current/vendor/magento/framework/App/Action/Action.php(102): Magento\Catalog\Controller\Adminhtml\Product\Save\Interceptor->execute()
#47 /var/www/vhosts/misskits.com/httpdocs/current/vendor/magento/module-backend/App/AbstractAction.php(226): Magento\Framework\App\Action\Action->dispatch(Object(Magento\Framework\App\Request\Http))
#48 /var/www/vhosts/misskits.com/httpdocs/current/vendor/magento/framework/Interception/Interceptor.php(74): Magento\Backend\App\AbstractAction->dispatch(Object(Magento\Framework\App\Request\Http))
#49 /var/www/vhosts/misskits.com/httpdocs/current/vendor/magento/framework/Interception/Chain/Chain.php(70): Magento\Catalog\Controller\Adminhtml\Product\Save\Interceptor->___callParent('dispatch', Array)
#50 /var/www/vhosts/misskits.com/httpdocs/current/vendor/magento/framework/Interception/Chain/Chain.php(63): Magento\Framework\Interception\Chain\Chain->invokeNext('Magento\\Catalog...', 'dispatch', Object(Magento\Catalog\Controller\Adminhtml\Product\Save\Interceptor), Array, 'adminAuthentica...')
#51 /var/www/vhosts/misskits.com/httpdocs/current/vendor/magento/module-backend/App/Action/Plugin/Authentication.php(143): Magento\Framework\Interception\Chain\Chain->Magento\Framework\Interception\Chain\{closure}(Object(Magento\Framework\App\Request\Http))
#52 /var/www/vhosts/misskits.com/httpdocs/current/vendor/magento/framework/Interception/Chain/Chain.php(67): Magento\Backend\App\Action\Plugin\Authentication->aroundDispatch(Object(Magento\Catalog\Controller\Adminhtml\Product\Save\Interceptor), Object(Closure), Object(Magento\Framework\App\Request\Http))
#53 /var/www/vhosts/misskits.com/httpdocs/current/vendor/magento/framework/Interception/Interceptor.php(138): Magento\Framework\Interception\Chain\Chain->invokeNext('Magento\\Catalog...', 'dispatch', Object(Magento\Catalog\Controller\Adminhtml\Product\Save\Interceptor), Array, 'adminMassaction...')
#54 /var/www/vhosts/misskits.com/httpdocs/current/vendor/magento/module-backend/App/Action/Plugin/MassactionKey.php(33): Magento\Catalog\Controller\Adminhtml\Product\Save\Interceptor->Magento\Framework\Interception\{closure}(Object(Magento\Framework\App\Request\Http))
#55 /var/www/vhosts/misskits.com/httpdocs/current/vendor/magento/framework/Interception/Interceptor.php(142): Magento\Backend\App\Action\Plugin\MassactionKey->aroundDispatch(Object(Magento\Catalog\Controller\Adminhtml\Product\Save\Interceptor), Object(Closure), Object(Magento\Framework\App\Request\Http))
#56 /var/www/vhosts/misskits.com/httpdocs/current/var/generation/Magento/Catalog/Controller/Adminhtml/Product/Save/Interceptor.php(39): Magento\Catalog\Controller\Adminhtml\Product\Save\Interceptor->___callPlugins('dispatch', Array, Array)
#57 /var/www/vhosts/misskits.com/httpdocs/current/vendor/magento/framework/App/FrontController.php(55): Magento\Catalog\Controller\Adminhtml\Product\Save\Interceptor->dispatch(Object(Magento\Framework\App\Request\Http))
#58 /var/www/vhosts/misskits.com/httpdocs/current/vendor/magento/framework/Interception/Interceptor.php(74): Magento\Framework\App\FrontController->dispatch(Object(Magento\Framework\App\Request\Http))
#59 /var/www/vhosts/misskits.com/httpdocs/current/vendor/magento/framework/Interception/Chain/Chain.php(70): Magento\Framework\App\FrontController\Interceptor->___callParent('dispatch', Array)
#60 /var/www/vhosts/misskits.com/httpdocs/current/vendor/magento/framework/Interception/Interceptor.php(138): Magento\Framework\Interception\Chain\Chain->invokeNext('Magento\\Framewo...', 'dispatch', Object(Magento\Framework\App\FrontController\Interceptor), Array, 'install')
#61 /var/www/vhosts/misskits.com/httpdocs/current/vendor/magento/framework/Module/Plugin/DbStatusValidator.php(69): Magento\Framework\App\FrontController\Interceptor->Magento\Framework\Interception\{closure}(Object(Magento\Framework\App\Request\Http))
#62 /var/www/vhosts/misskits.com/httpdocs/current/vendor/magento/framework/Interception/Interceptor.php(142): Magento\Framework\Module\Plugin\DbStatusValidator->aroundDispatch(Object(Magento\Framework\App\FrontController\Interceptor), Object(Closure), Object(Magento\Framework\App\Request\Http))
#63 /var/www/vhosts/misskits.com/httpdocs/current/var/generation/Magento/Framework/App/FrontController/Interceptor.php(26): Magento\Framework\App\FrontController\Interceptor->___callPlugins('dispatch', Array, Array)
#64 /var/www/vhosts/misskits.com/httpdocs/current/vendor/magento/framework/App/Http.php(135): Magento\Framework\App\FrontController\Interceptor->dispatch(Object(Magento\Framework\App\Request\Http))
#65 /var/www/vhosts/misskits.com/httpdocs/current/vendor/magento/framework/App/Bootstrap.php(258): Magento\Framework\App\Http->launch()
#66 /var/www/vhosts/misskits.com/httpdocs/current/pub/index.php(37): Magento\Framework\App\Bootstrap->run(Object(Magento\Framework\App\Http))
#67 {main} [] []

Any hint? Please I really don't know why this is happening, I tried to change the magento mode again, reupgrade, recompile and deploy again but the same error is displayed.

 

EDIT: This only happens when I create a new one and save, when I edit one that already exists it works perfectly and only hapens with products, I can generate other content like pages without problem. 

 

Thank you,

1 REPLY 1

Re: Can't create new product database error

Creating the columns it uses in the table 'catalog_product_entity' actually solves the error and can create products fine, but I don't think its a good idea leave it like this.

 

I had to create the column 'store_id' and 'attribute_id', with value 0 and after that all works.

 

EDIT: Well, its not working at all. It creates simple products without problem, but configurable or bundle products break. And the configurable product doesn't show the diferent options when these columns are created, if I delete the columns works as before including the new products created.