CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Core CiviCRM Functions (Moderator: Yashodha Chaku) »
  • Errors when deleting custom fields
Pages: [1]

Author Topic: Errors when deleting custom fields  (Read 571 times)

robinhood

  • I post frequently
  • ***
  • Posts: 153
  • Karma: 6
  • CiviCRM version: 4.5.5
  • CMS version: Drupal 7.34
  • MySQL version: 5.1.56
  • PHP version: 5.3.5
Errors when deleting custom fields
January 12, 2012, 04:17:45 am
I believe that this problem started when I accidentally clicked twice when deleting a custom data field.  The second click probably interrupted the first, so it did not complete the delete action.  Now the fields still show up, but there are errors when I try to run the delete again.

Quote
DB Error: not found
Error Details
Additional Details:
Code: [Select]
Array
(
    [callback] => Array
        (
            [0] => CRM_Core_Error
            [1] => handle
        )

    [code] => -4
    [message] => DB Error: not found
    [mode] => 16
    [debug_info] =>         ALTER TABLE civicrm_value_1_Forge_Ahead_Information DROP COLUMN `Mentor_` [nativecode=1091 ** Can't DROP 'Mentor_'; check that column/key exists]
    [type] => DB_Error
    [user_info] =>         ALTER TABLE civicrm_value_1_Forge_Ahead_Information DROP COLUMN `Mentor_` [nativecode=1091 ** Can't DROP 'Mentor_'; check that column/key exists]
    [to_string] => [db_error: message="DB Error: not found" code=-4 mode=callback callback=CRM_Core_Error::handle prefix="" info="        ALTER TABLE civicrm_value_1_Forge_Ahead_Information DROP COLUMN `Mentor_` [nativecode=1091 ** Can't DROP 'Mentor_'; check that column/key exists]"]
)

Or this:

Quote
DB Error: constraint violation
Error Details
Additional Details:
Code: [Select]
Array
(
    [callback] => Array
        (
            [0] => CRM_Core_Error
            [1] => handle
        )

    [code] => -3
    [message] => DB Error: constraint violation
    [mode] => 16
    [debug_info] => DELETE FROM civicrm_custom_field  WHERE (  civicrm_custom_field.id = 55 )  [nativecode=1451 ** Cannot delete or update a parent row: a foreign key constraint fails (`yfc_website`.`civicrm_custom_value`, CONSTRAINT `FK_civicrm_custom_value_custom_field_id` FOREIGN KEY (`custom_field_id`) REFERENCES `civicrm_custom_field` (`id`))]
    [type] => DB_Error
    [user_info] => DELETE FROM civicrm_custom_field  WHERE (  civicrm_custom_field.id = 55 )  [nativecode=1451 ** Cannot delete or update a parent row: a foreign key constraint fails (`yfc_website`.`civicrm_custom_value`, CONSTRAINT `FK_civicrm_custom_value_custom_field_id` FOREIGN KEY (`custom_field_id`) REFERENCES `civicrm_custom_field` (`id`))]
    [to_string] => [db_error: message="DB Error: constraint violation" code=-3 mode=callback callback=CRM_Core_Error::handle prefix="" info="DELETE FROM civicrm_custom_field  WHERE (  civicrm_custom_field.id = 55 )  [nativecode=1451 ** Cannot delete or update a parent row: a foreign key constraint fails (`yfc_website`.`civicrm_custom_value`, CONSTRAINT `FK_civicrm_custom_value_custom_field_id` FOREIGN KEY (`custom_field_id`) REFERENCES `civicrm_custom_field` (`id`))]"]
)

Suggestions?

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Errors when deleting custom fields
January 12, 2012, 08:44:31 am

You will need to delete the custom field from civicrm_custom_field manually. You'll also need to drop the column in the table:

civicrm_value_1_Forge_Ahead_Information

manually if it exists

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Core CiviCRM Functions (Moderator: Yashodha Chaku) »
  • Errors when deleting custom fields

This forum was archived on 2017-11-26.