0

When doing a contact search using tags from search builder Civi throws DB syntax error, this was working before until Civi upgraded to 5.35.1

enter image description here

Error:

SELECT DISTINCT LEFT(contact_a.sort_name, 1) as sort_name\n
               FROM civicrm_contact contact_a    LEFT JOIN civicrm_entity_tag `civicrm_entity_tag-60788273efd52` ON ( `civicrm_entity_tag-60788273efd52`.entity_id = contact_a.id  AND `civicrm_entity_tag-60788273efd52`.entity_table = 'civicrm_contact')  \n
              WHERE  (  ( `civicrm_entity_tag-60788273efd52`.tag_id IN (  ) )  )  AND ( 1 ) AND (contact_a.is_deleted = 0) [nativecode=1064 ** You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ') )  )  AND ( 1 ) AND (contact_a.is_deleted = 0)' at line 3]
        """
1

Can you check if the tag you selected is a parent tag and has child tags? If yes than this is a known bug on 5.35.1 when doing a search on parent tag and is logged at https://lab.civicrm.org/dev/core/-/issues/2502 and is fixed as part of 5.38 release.

Solution(one of the below):

  1. Use 'IN' operator instead of '='.
  2. Apply patch from here.
  3. Wait for 5.38.0 release
1
  • Thanks for your help, the patch fixed the problem for us Apr 15 at 23:12

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.