1

We enabled multi language support in Civi 5.21.1 then tried to create a new custom field group with Select or Radio options. The error from the DB is below (***edit: This doesn't happen when adding fields to an existing Group):-

[db_error: message="DB Error: already exists" code=-5 mode=callback callback=CRM_Core_Error::handle prefix="" info="INSERT INTO civicrm_custom_field (custom_group_id , name , label , data_type , html_type , default_value , is_required , is_searchable , is_search_range , weight , help_pre , help_post , is_active , is_view , options_per_line , text_length , start_date_years , end_date_years , date_format , time_format , note_columns , note_rows , column_name , option_group_id , filter , in_selector ) VALUES ( 77 , 'Test_2' , 'Test 2' , 'String' , 'Radio' ,  NULL ,  NULL ,  NULL ,  0 ,  2 ,  NULL ,  NULL ,  1 ,  NULL ,  NULL ,  255 ,  NULL ,  NULL ,  NULL ,  NULL ,  60 ,  4 , 'test_2' ,  204 ,  NULL ,  0 )  [nativecode=1062 ** Duplicate entry '77' for key 'UI_label_custom_group_id_en_GB']"]

After doing some digging, it seems that two tables now have additional keys:-

custom_data_group has the key 'UI_title_extends_en_GB' custom_data_field has the key 'UI_label_custom_group_id_en_GB'

After disabling multi language support, the keys remain and we are still unable to add options.

Removing the keys from MySQL using the commands below resolves the error:-

alter table civicrm_custom_field drop index UI_label_custom_group_id_en_GB;

and for the group:-

alter table civicrm_custom_group drop index UI_title_extends_en_GB

Is it safe to enable multi language support without these keys?

1
  • I've noticed this error only happens when creating Select or Option fields within a new Custom Field Group. If you add them to an existing Group, the error is not present.
    – Darren
    Feb 12, 2020 at 12:56

1 Answer 1

1

CiviCRM adds indexes to custom field only if its searchable(checkbox ticked for is searchable field). Removing it might impact performance if your system has lots of records but you won't notice if its only 1k to 10k records.

But you trying to remove index which is not being used, so that should be fine.

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.