SQL Table Prefix – getTableName Not Adding Table Prefix for One Table Only

coredatabasesql

We have a prefix in our Magento DB: prefix_

Now, Magento has been working fine for years. But in one of the extension when we call the code below. Instead of printing prefix_catalog_product_index_price it prints catalog_product_index_price. The prefix_ is missing.

prefix_catalog_product_index_price exists in the database just like all the other tables.

$adapter = Mage::getResourceSingleton('core/resource')->getReadConnection();
Mage::log($adapter->getTableName('catalog_product_index_price'));

$adapter = Mage::getSingleton('core/resource')->getConnection('core_read');
Mage::log($adapter->getTableName('catalog_product_index_price'));

What can this be?

Why is getTableName not working? or adding the prefix?

Best Answer

Maybe it's a little bit late, but for anyone who is searching for the correct answer here it is

Mage::getSingleton('core/resource')->getTableName('customer_entity');

It will returns "yourtableprefix_customer_entity"