0

In watchdog I am seeing an error when cron is run.

Drupal\Core\Database\DatabaseExceptionWrapper: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'tdtvnksvps.field_deleted_data_38d3088921' doesn't exist: SELECT DISTINCT t.entity_id AS entity_id FROM {field_deleted_data_38d3088921} t WHERE bundle = :db_condition_placeholder_0 LIMIT 50 OFFSET 0; Array ( [:db_condition_placeholder_0] => ) in Drupal\Core\Entity\Sql\SqlContentEntityStorage->readFieldItemsToPurge() (line 1686 of /home/300465.cloudwaysapps.com/tdtvnksvps/public_html/web/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php).

Pretty sure I mistakenly deleted a table from the database a while back and this is the result.

The issue appears to be similar to Error when deleting some node, but I think the advice given to find a record of the deleted field was written for D7.

Is this the same problem and how resolve it for D8?

2

I Had this issue sometimes ago, I deleted a field table from DB manually and this error started to showing up, A way to get rid of it is to create a table for a field, so you can use a mysql code like that :

CREATE TABLE `field_deleted_data_38d3088921` (
    `bundle` varchar(128) CHARACTER SET ascii NOT NULL DEFAULT '' COMMENT 'test',
    `deleted` tinyint(4) NOT NULL DEFAULT '0' COMMENT 'A boolean indicating whether this data item has been deleted',
    `entity_id` int(10) unsigned NOT NULL COMMENT 'The entity id this data is attached to',
    `revision_id` int(10) unsigned NOT NULL COMMENT 'The entity revision id this data is attached to',
    `langcode` varchar(32) CHARACTER SET ascii NOT NULL DEFAULT '' COMMENT 'The language code for this data item.',
    `delta` int(10) unsigned NOT NULL COMMENT 'The sequence number for this data item, used for multi-value fields',
    `test` varchar(2048) DEFAULT NULL COMMENT 'test',
    PRIMARY KEY(`entity_id`,`deleted`,`delta`,`langcode`),
    KEY `bundle` (`bundle`),
    KEY `revision_id` (`revision_id`)
)
| improve this answer | |
  • 1
    Great idea, then you can run cron and when the purge job sees there are no field records present in the empty table it removes the table and the config pointing at the table. – 4k4 Feb 4 at 10:24
  • This worked a treat. Thank you both for the input. – MrPaulDriver Feb 4 at 17:08
2

This issue is the opposite of Can I delete leftover field_deleted_* tables?. In your case you have leftover field and field storage config entities serialized in the database table key_value as state collection in the keys field.field.deleted and field.storage.deleted.

Normally both, the config entities and the deleted tables, are removed in cron runs.

| improve this answer | |
  • Thank you for the explanation – MrPaulDriver Feb 4 at 17:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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