magento2: Error while reindexing price
Preconditions
- Magento ver. 2.2.6
- PHP 7.0.26 (cli) (built: Nov 21 2017 14:36:41) ( NTS )
Steps to reproduce
- After upgrading magento from version 2.2.2 to 2.2.6
Expected result
- Reindexing of price
Actual result
- While reindexing price it shows error
Base table or view not found: 1146 Table catalog_product_index_price_temp’ doesn’t exist, query was: SELECT i.entity_id, o.option_id FROM catalog_product_index_price_temp AS i
INNER JOIN catalog_product_entity AS e ON e.entity_id = i.entity_id
INNER JOIN catalog_product_option AS o ON o.product_id = e.entity_id
suffix temp is used instead of tmp
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 26 (10 by maintainers)
This is true and it helped me a lot. I used it as a starting point for debugging. In my case I discovered an enabled module in my repository with the following code:
This basically created a new instance of the object manager which was the reason why a different MySQL connection was used which in turn caused the error with the missing table.
So I recently had this issue with 2.3.4-p2. I dug a little bit further and I think there is nothing wrong with table names per-say. In
Magento\ConfigurableProduct\Model\ResourceModel\Product\Indexer\Price\Configurablethere is a method called executeByDimensions. This method callsMagento\Catalog\Model\Indexer\Product\Price\TableMaintainercreateMainTmpTable method. This method creates a TEMPORARY table with the suffix “_temp” which is supposed to be exactly as the “_tmp”. This is intentional. The issue happens when the MySQL session is halted for some reason and the temporary table disappears. So there is probably room for improvement here but if you run into that issue I guess you should focus more on the MySQL settings and make sure there are no long-running queries into that TEMPORARY table.Here is a patch file, you can use if you’re interested:
I’m struggling to understand this whole post. Where is fix to this issue? I can see labels saying fixed in 2.3, however version 2.3 hasn’t yet been released! I need this fix on my website asap or at least walk around solution to it. I cannot add any products to my website as they won’t appear unless indexed.
Hi, I think the error is because of getIdxTable function in vendor/magento/module-catalog/Model/ResourceModel/Product/Indexer/Price/DefaultPrice.php. It is returning table name as “catalog_product_index_price_temp” while it should be “catalog_product_index_price_tmp”
public function getIdxTable($table = null) { return $this->tableStrategy->getTableName(‘catalog_product_index_price’); }