Fixing reindexing price errors in Magento

I’ve upgraded a couple of Magento CE (1.4) to Magento EE (1.11) using the traditional (and effective) way. But I found that there was an important issue when reindexing prices that prevented Magento from doing it.

Reading this post on Magento Boards I found that the problem (in my case) was related to an error with the catalog_product_entity_tier_price table where some of the entries were related to products that didn’t exist anymore. This was the actual error and when trying to reindex product prices, Magento would throw this message: