Copy event fails with DB Error: already exists; Saving new reminder hangs
Overview
Copying an event fails with "DB Error: already exists" if a reminder with the same name (but different case) exists in civicrm_action_schedule.
Also, while editing an event, saving a new event reminder hangs if a reminder with the same name (but different case) exists in civicrm_action_schedule.
Reproduction steps
- Edit an event and create an reminder with name "reminder".
- Then create a reminder with the name "Reminder".
Current behaviour
Infinite spinner.
Environment information
- CiviCRM: 5.67
- Database: MariaDB 10.4
- CMS: Drupal 9.5
Comments
Both issues are due to the 5.66-alpha1 addition of the index civicrm_action_schedule.UI_name
.
While CRM_Core_DAO::makeNameFromLabel() ensures that the new name is unique in a case-sensitive context, the name
column has the default ci collation, making the index case insensitive. As a result, violations of the 'unique' constraint can occur.