OJS 3.1.1-2: DB error in Archive view



I recently updated an OJS3 installation with all commits in the branch ojs-stable-3_1_1 between May 23rd and today, for both OJS and pkp-lib. Running the upgrade script only produced a few warnings (as far as I can tell insignificant ones). After the upgrade I get the following error when I open the Archives section of a journal:

DB Error: ERROR: column "o.seq" must appear in the GROUP BY clause or be used in an aggregate function LINE 1: ...published" = $2 group by "i"."issue_id" order by "o"."seq" ... ^
Stack Trace:
File: /...../classes/services/IssueService.inc.php line 56
Function: DAO->retrieveRange("select "i".* from "issues" as "i" left join "issue_settings" as ...", Array(2), Object(DBResultRange))

File: /...../pages/issue/IssueHandler.inc.php line 137
Function: OJS\Services\IssueService->getIssues("14", Array(5))


By looking at the code diffs I managed to “solve” the issue by commenting out lines 71 and 72 in classes/services/queryBuilders/IssueListQueryBuilder.inc.php, i.e.

    //} elseif ($column === 'seq') {
    //    $this->orderColumn = 'o.seq';

Our installation uses Postgres. Our code is very close to upstream (https://github.com/ubbdst/ojs/tree/ojs-3_1_1-2, https://github.com/ubbdst/pkp-lib/tree/ojs-stable-3_1_1), there are mainly a few plugin submodules, some locale stuff, and for pkp-lib the adodb postgres patch. To me it looks like this could be either a postgres-incompatibility, or something that was missed in an upgrade script?



I also just had a problem with upgrading to the latest release 3.1.1-2 from on a postgres based install. The update ran through (after adding the adobd patches) but all submissions were gone (was not able to solve the issue after two tries, so stayed at Maybe this is related? I did not see a db error in the error.log though.


On a test server we went from 3.1.1-0 to 3.1.1-4 in one jump, on a postgres d/b system. We have the same error. I can confirm that @simonmitternacht’s solution worked for us. Archive view doesn’t throw an error after commenting out the one “elseif”. Looking forward to seeing a less hacky solution.