Entity providing modules must call field_attach_delete_bundle() in hook_uninstall()

Created on 4 April 2011, over 13 years ago
Updated 15 December 2023, about 1 year ago

The error happen by this context:

1. Add field type "text" to bundle "catalog" (entity type "taxonomy_term") name "catalog_info"
2. Create 1 term for "catalog" name "Sony" this seem to be ok
3. Reinstall (disable -> uninstall -> enable) module "taxonomy"
4. Enable module "taxonomy"
5. Create a bundle (vocabulary) name "catalog" (same name with the first one)
6. The bundle "catalog" also has field name "catalog_info"
7. Add 1 term name "Toshiba" for "catalog"

And the error happen:

"PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'taxonomy_term-1-0-0-und' for key 'PRIMARY': INSERT INTO {field_data_field_catalog_info} (entity_type, entity_id, revision_id, bundle, delta, language, field_catalog_info_value, field_catalog_info_format) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4, :db_insert_placeholder_5, :db_insert_placeholder_6, :db_insert_placeholder_7); Array ( [:db_insert_placeholder_0] => taxonomy_term [:db_insert_placeholder_1] => 1 [:db_insert_placeholder_2] => 1 [:db_insert_placeholder_3] => catalog [:db_insert_placeholder_4] => 0 [:db_insert_placeholder_5] => und [:db_insert_placeholder_6] => Toshiba [:db_insert_placeholder_7] => ) in field_sql_storage_field_storage_write() (line 425 of /home/haonguyen/www/testa_og/modules/field/modules/field_sql_storage/field_sql_storage.module)
"

After that, i find one reason for this:
+ Because the the module "taxonomy" doesn't clear the table "field_data_catalog_info" after i reinstall module "taxonomy" so the "duplicate entry error" happen

📌 Task
Status

Fixed

Version

9.5

Component
Field 

Last updated 2 days ago

Created by

🇻🇳Vietnam howto

Live updates comments and jobs are added and updated live.
  • Needs backport to D7

    After being applied to the 8.x branch, it should be considered for backport to the 7.x branch. Note: This tag should generally remain even after the backport has been written, approved, and committed.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024