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

If you activate extended Logging, the lookup-function in the change-log tab fails on large databases.

    Details

    • Type: Bug
    • Status: Done/Fixed
    • Priority: Minor
    • Resolution: Fixed/Completed
    • Affects Version/s: 4.4.4, 4.4.5
    • Fix Version/s: 4.5
    • Component/s: None
    • Labels:
      None

      Description

      The following query causes the problem:

      "SELECT DISTINCT lt.id FROM `civicrm`.`log_civicrm_note` lt
      WHERE lt.log_conn_id = 219
      AND lt.log_date BETWEEN DATE_SUB('20140424093302', INTERVAL 10 SECOND)
      AND DATE_ADD('20140424093302', INTERVAL 10 SECOND)
      AND ( entity_id = 202 AND entity_table = 'civicrm_contact' )
      OR (entity_id IN (SELECT note.id FROM `civicrm`.log_civicrm_note note
      WHERE note.entity_id = 202 AND note.entity_table = 'civicrm_contact')
      AND entity_table = 'civicrm_note');"

      More precisely, the last part of the query:

      "AND ( entity_id = 202 AND entity_table = 'civicrm_contact' )
      OR (entity_id IN (SELECT note.id FROM `civicrm`.log_civicrm_note note
      WHERE note.entity_id = 202 AND note.entity_table = 'civicrm_contact')
      AND entity_table = 'civicrm_note');"

      (built by CRM/Logging/Differ.php:79 as $contactIdClause) should
      obviously filter the notes associated to a specific contact.
      But the lack of parenthesis around the OR-operator changes the hierarchy
      of the entire WHERE clause.

      I think this should be one AND-clause with an encapsulated OR-clause:

      "AND (( entity_id = 202 AND entity_table = 'civicrm_contact' ) OR
      (entity_id IN (SELECT note.id FROM `civicrm`.log_civicrm_note note WHERE
      note.entity_id = 202 AND note.entity_table = 'civicrm_contact') AND
      entity_table = 'civicrm_note'));"

        Attachments

          Activity

            People

            • Assignee:
              monish.deb Monish Deb
              Reporter:
              thomst Thomas Leichtfuß
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: