Skip to content

catalog_product_index_price_temp not found when running upgrade command?

Magento 2.4.6

Suddenly I am getting the following error when running my upgrade command php bin/magento setup:upgrade (worked for weeks without problems):

Base table or view not found: 1146 Table ‘catalog_product_index_price_temp’ doesn’t exist

The query which was executed in the background was:

UPDATE `catalog_product_index_price_temp` AS `i`
INNER JOIN `catalog_product_index_website` AS `cpiw` ON cpiw.website_id = i.website_id
INNER JOIN `catalogrule_product_price` AS `cpp` ON cpp.product_id = i.entity_id AND cpp.customer_group_id = i.customer_group_id AND cpp.website_id = i.website_id AND cpp.rule_date = cpiw.website_date
SET `i`.`final_price` = LEAST(final_price, IFNULL(cpp.rule_price, i.final_price)), `i`.`min_price` = LEAST(min_price, IFNULL(cpp.rule_price, i.min_price))
WHERE (i.entity_id IN (....))

I searched a bit and found that it might be related to CustomOptionPriceModifier.php which returns a wrong table name (catalog_product_index_price_temp instead of catalog_product_index_price_tmp) and I applied a fix suggested on GitHub, but it did not solve my problem.

Any ideas how to solve that?