0

When listing recipients of CiviMail either via advanced search or mailing report¹ I get a wrong row count query. See the where-clause in

SELECT count(DISTINCT contact_a.id) as rowCount  FROM civicrm_contact contact_a   
LEFT JOIN civicrm_mailing_recipients ON civicrm_mailing_recipients.contact_id = contact_a.id
LEFT JOIN civicrm_mailing ON civicrm_mailing.id = civicrm_mailing_recipients.mailing_id
WHERE  (  AND civicrm_mailing.id IN (2198) )  AND (contact_a.is_deleted = 0) 

This is generated by CRM\Contact\Bao\Query.php.

Before I dig down into all the query generating code: Did anybody of you civi gurus out there see this before?

Relevant stacktrace is:

#10 /civicrm/packages/DB/DataObject.php(1607): DB_DataObject->_query("SELECT count(DISTINCT contact_a.id) as rowCount  FROM civicrm_contact contact...")
#11 /civicrm/CRM/Core/DAO.php(420): DB_DataObject->query("SELECT count(DISTINCT contact_a.id) as rowCount  FROM civicrm_contact contact...")
#12 /civicrm/CRM/Core/DAO.php(1496): CRM_Core_DAO->query("SELECT count(DISTINCT contact_a.id) as rowCount  FROM civicrm_contact contact...", TRUE)
#13 /civicrm/CRM/Contact/BAO/Query.php(4977): CRM_Core_DAO::singleValueQuery("SELECT count(DISTINCT contact_a.id) as rowCount  FROM civicrm_contact contact...")
#14 /civicrm/CRM/Contact/Selector.php(525): CRM_Contact_BAO_Query->searchQuery(0, 0, NULL, TRUE)
#15 /civicrm/CRM/Core/Selector/Controller.php(218): CRM_Contact_Selector->getTotalCount(4, NULL)

¹) URI on error is /civicrm/contact/search/advanced?force=1&mailing_id=<MAILING_ID>

1

The issue you getting has been now fixed and will be part of 5.23 release. You can either wait for 5.23 release and upgrade CiviCRM or apply patch from here.

HTH

Pradeep

3

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.