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

Searching profiles by multiple tags causes database error 1241

    Details

    • Type: Bug
    • Status: Done/Fixed
    • Priority: Minor
    • Resolution: Fixed/Completed
    • Affects Version/s: 3.3.2
    • Fix Version/s: 3.3.3
    • Component/s: None
    • Labels:
      None

      Description

      Create a new CiviCRM profile and set the Used for as profile. Add fields as necessary, including Tag(s) which should be searchable. Access the profile via its URL such as http://drupal.demo.civicrm.org/civicrm/profile?reset=1&gid=9. When a single tag is selected during the search the search completes successfully. When two or more tags are selected the search throws the following error:

      Database Error Code: Operand should contain 1 column(s), 1241
      Additional Details:
      Array
      (
      [callback] => Array
      (
      [0] => CRM_Core_Error
      [1] => handle
      )

      [code] => a515ac9c2796ca0e23adbe92c68fc9fc
      [message] => DB Error: a515ac9c2796ca0e23adbe92c68fc9fc
      [mode] => 16
      [debug_info] => SELECT count(DISTINCT contact_a.id) FROM civicrm_contact contact_a LEFT JOIN civicrm_entity_tag `civicrm_entity_tag-2,3` ON ( `civicrm_entity_tag-2,3`.entity_id = contact_a.id AND
      `civicrm_entity_tag-2,3`.entity_table = 'civicrm_contact' ) WHERE ( `civicrm_entity_tag-2,3`.tag_id = (2,3) ) AND ( 1 ) [nativecode=1241 ** Operand should contain 1 column(s)]
      [type] => DB_Error
      [user_info] => SELECT count(DISTINCT contact_a.id) FROM civicrm_contact contact_a LEFT JOIN civicrm_entity_tag `civicrm_entity_tag-2,3` ON ( `civicrm_entity_tag-2,3`.entity_id = contact_a.id AND
      `civicrm_entity_tag-2,3`.entity_table = 'civicrm_contact' ) WHERE ( `civicrm_entity_tag-2,3`.tag_id = (2,3) ) AND ( 1 ) [nativecode=1241 ** Operand should contain 1 column(s)]
      [to_string] => [db_error: message="DB Error: a515ac9c2796ca0e23adbe92c68fc9fc" code=0 mode=callback callback=CRM_Core_Error::handle prefix="" info="SELECT count(DISTINCT contact_a.id) FROM civicrm_contact contact_a LEFT JOIN civicrm_entity_tag `civicrm_entity_tag-2,3` ON ( `civicrm_entity_tag-2,3`.entity_id = contact_a.id AND
      `civicrm_entity_tag-2,3`.entity_table = 'civicrm_contact' ) WHERE ( `civicrm_entity_tag-2,3`.tag_id = (2,3) ) AND ( 1 ) [nativecode=1241 ** Operand should contain 1 column(s)]"]
      )

      It appears that the WHERE clause is using the '=' sign when selecting the tag IDs. My guess is that simply needs to be changed to the IN keyword.

        Attachments

          Activity

            People

            • Assignee:
              ashwini Ashwini Poharkar
              Reporter:
              mdatcher Matthew Datcher
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: