Uploaded image for project: 'CiviCRM'
  1. CiviCRM
  2. CRM-1759

Foreign key constraint fails when not using headers or footers

    Details

    • Type: Bug
    • Status: Done/Fixed
    • Priority: Major
    • Resolution: Fixed/Completed
    • Affects Version/s: 1.7
    • Fix Version/s: 2.0
    • Component/s: CiviMail
    • Labels:
      None

      Description

      When trying to send a mailing without headers or footers I a foreign key restraint failure:

      (`membership-crm/civicrm_mailing`, CONSTRAINT `civicrm_mailing_ibfk_2` FOREIGN KEY (`header_id`) REFERENCES `civicrm_mailing_component` (`id`)), 1452

      The MySQL that generates the error:

      INSERT INTO civicrm_mailing (domain_id , reply_id , unsubscribe_id , optout_id , name , from_name , from_email , replyto_email , subject , body_text , body_html , is_template , url_tracking , forward_replies , auto_responder , open_tracking , is_completed ) VALUES (......

      As we can see, CiviMail is reasonably not inserting a value into "header_id" (Since we are not using a header), however the FK expects there to be a header_id no matter what.

      The best solution would be if there where a way to modify the FK so that it only cares about the FK if header_id is non-null. We could then insert "header_id" as NULL on the query if there are no headers being used. However, i'm not sure you can make a FK behave like this.

        Attachments

          Activity

            People

            • Assignee:
              sunil Sunil Pawar
              Reporter:
              phayes Patrick Hayes
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: