Skip to content
GitLab
Projects Groups Topics Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
  • CiviCRM Core CiviCRM Core
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Graph
    • Compare revisions
  • Issues 1k
    • Issues 1k
    • List
    • Boards
    • Service Desk
    • Milestones
  • Deployments
    • Deployments
    • Releases
  • Packages and registries
    • Packages and registries
    • Model experiments
  • Wiki
    • Wiki
  • Activity
  • Graph
  • Create a new issue
  • Commits
  • Issue Boards
Collapse sidebar
  • DevelopmentDevelopment
  • CiviCRM CoreCiviCRM Core
  • Issues
  • #3555

Mailing Error when civicrm_mailing_group has duplicate entries of recipient groups

I see a number of entries in civicrm_mailing_group with same entity_id, entity_table, group_type and mailing_id values.

I think this should've been avoided by civi by making this combination of field as unique keys?

If not - re-using such mailings can lead to an error when group_concat exceeds its maximum length of holding the value of group ids at https://github.com/civicrm/civicrm-core/blob/master/CRM/Mailing/BAO/Mailing.php#L123

    $dao = CRM_Utils_SQL_Select::from('civicrm_mailing_group')
      ->select('GROUP_CONCAT(entity_id SEPARATOR ",") as group_ids, group_type, entity_table')
      ->where('mailing_id = #mailing_id AND entity_table RLIKE "^civicrm_(group.*|mailing)$" ')
      ->groupBy(['group_type', 'entity_table'])
      ->param('!groupTableName', CRM_Contact_BAO_Group::getTableName())
      ->param('#mailing_id', $mailingID)
      ->execute();

Default max length is 1024 which leads to the following error if number of characters are more.

image

Maybe, we just need to use DISTINCT in the above query? I'll create a PR for it soon.

Edited Apr 21, 2020 by jitendra
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking