PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table ‘DATABASE.field_data_field_DELETED_FIELD’ doesn’t exist

Drupal 7 Error.

The scenario is: you deleted a field from one of your content types, but you later get this PDOException.

The error is saying that it can’t find a table with the name of the deleted field.

The solution is to go into mysql and remove the ‘ghost’ field entry from field_config and field_config_instance.
drush sql-cli
mysql> DELETE FROM field_config WHERE field_name = ‘field_DELETED_FIELD’;
mysql> DELETE FROM field_config_instance WHERE field_name = ‘field_DELETED_FIELD’;
drush cc all

(don’t forget to clear cache after deleting)

It seems that the existence of these ghost entries in field_config and field_config_instance is leading drupal to look for the field values (which it expects to find in Table ‘DATABASE.field_data_field_DELETED_FIELD’

With thanks to googletorp: http://drupal.stackexchange.com/questions/27158/error-when-deleting-some-node
and bek: http://technonaturalist.net/blog/2011/01/drupal-7-notes-dealing-ghost-fields

Advertisements
Posted in drupal

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: