Uploaded image for project: 'jBPM'
  1. jBPM
  2. JBPM-10194

Fix TASK_AVG_DURATION query for postgres

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Minor Minor
    • None
    • 7.74.1.Final
    • Persistence
    • None
    • False
    • None
    • False
    • NEW
    • NEW
    • ---
    • ---

      When executing TotalCompletionTimeAssignmentStrategyTest with postgres as db, we obtain the following exception:

      Caused by: org.postgresql.util.PSQLException: ERROR: column "bamtasksum0_.taskname" must appear in the GROUP BY clause or be used in an aggregate function
      Position: 119

      This is the query:
      private static String TASK_AVG_DURATION = ""
      + "select new org.jbpm.services.task.assignment.impl.TaskAverageDuration(avg(bts.duration),t.taskData.deploymentId,t.taskData.processId,bts.taskName) "
      + "from BAMTaskSummaryImpl bts left join TaskImpl t on (bts.taskId = t.id) "
      + "where (bts.duration is not null) and t.taskData.processId = :procid and t.taskData.deploymentId = :depid and t.name = :taskname "
      + "group by t.taskData.deploymentId, t.taskData.processId, t.name";

      Usual approach to fixing this error is to simply write all the columns from SELECT in the GROUP BY clause, therefore including "bts.taskName" in the group by clause.

            gmunozfe@redhat.com Gonzalo Muñoz Fernández
            gmunozfe@redhat.com Gonzalo Muñoz Fernández
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: