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

SQL syntax error in GROUP BY clause: CRM_Report_Form::groupBy sets array instead of string

    Details

    • Type: Patch
    • Status: Done/Fixed
    • Priority: Minor
    • Resolution: Fixed/Completed
    • Affects Version/s: 3.4.8, 4.0.8
    • Fix Version/s: 4.1.0
    • Component/s: CiviReport
    • Labels:
      None

      Description

      The current groupBy() method sets $_groupBy as an array of group-by definitions, but the buildQuery() method is expecting a fully built group by clause starting with "GROUP BY". This results in queries like "SELECT * FROM civicrm_foo WHERE (1) Array" (instead of "SELECT * FROM civicrm_foo foo WHERE (1) GROUP BY foo.id") so of course we get an SQL syntax error.

      The current code appears to have been added for CRM-8503, before which this method was just a placeholder that needed to be overridden by the extending report class – I'm guessing this is why the bug has not been spotted until now.

        Attachments

          Activity

            People

            • Assignee:
              deepak Deepak Srivastava
              Reporter:
              allenshaw Allen Shaw
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: