I'm facing very strange problem with changing my custom entity's fields. I've a custom entity with id, type, .. , premium, premium_expires_at, .. fields. It was working without any problems with its own fields (those declared in hook_schema()) till today, but suddenly I changed its fields, dropped premium, and premium_expires_at fields, added new fields with HOOK _update_n function. I see database schema changed, but those deleted fields are still being shown in base table key under field_sql_storage key.. I've already ran update.php (many times), but no luck.. I thought it's a caching problem, so I've cleared all caches manually, and with drush, no luck, cleared memcached data (with telnet), any changes.Every time I'm getting the same error, like this:

PDOException: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'base.premium' in 'field list': SELECT ... base.premium AS premium... в функции EntityCacheControllerHelper::entityCacheLoad() (строка 101 в файле /PATH_TO_MY_PROJECT/sites/all/modules/entitycache/entitycache.module)

I don't have any premium field in my db schema, but still getting this error, is there any way to solve it?

(I am using EntityAPI with Entitycache and Memcache Storage modules).

  • Try clearing the cache bins manually (all of them). That error would suggest entitycache is still getting stale data
    – Clive
    Sep 9, 2014 at 10:59
  • @Clive hi, thanks for the response. I've already cleared them, multiple times, all tables with beginng cache*..
    – xurshid29
    Sep 9, 2014 at 11:00
  • Have you completely removed the memcache data (i.e. used flush_all)?
    – Clive
    Sep 9, 2014 at 11:02
  • @Clive yes, removed them with telnet 11212 (11212 this is the port wich my project uses) -> flush_all..
    – xurshid29
    Sep 9, 2014 at 11:03
  • Probably the next thing is to uninstall entitycache completely (not just disable), see if the problem persists. It probably won't, then you should be able to re-install entitycache and be on your way. In theory at least
    – Clive
    Sep 9, 2014 at 11:05

1 Answer 1


I finally solved this problem somehow.. I think this is an EntityAPI's issue. So, here is my (temporary) solution:

  • removed those changed fields directly from hook_schema, added new fields directly to it.
  • removed those fields with db_drop_field function and added new fields with db_add_field function with hook_update_n function. By this way I managed to have the same structure in my (changed) entity and db table schema.
  • flushed the caches

Error has gone, so far everything is working fine. But I'm not sure this solution will not cause any problems in future... I still can't understand why entity api doesn't see changed fields in hook_update_n function...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.