OJS-2.4.7.1 Stats & Reports Error

I have a journal that when I go to Journal Management → Stats & Reports I immediately get this error message in the browser:-
DB Error: ERROR: syntax error at or near “WHERE” LINE 7: WHERE a2.article_id IS NULL AND ^

The error.log is giving me:-
[Thu Jan 28 13:42:01.386661 2016] [:error] [pid 8680] [client 10.70.128.235:59785] ojs2: DB Error: ERROR: syntax error at or near “WHERE”\nLINE 7: WHERE a2.article_id IS NULL AND\n ^, referer: http://usurj.journalhosting.ucalgary.ca/usurj/index.php/usurj/manager

This is a new installation full installation from OJS-2.4.7 then an update to OJS-2.4.7.1

This installation is using PostgreSQL.

So what happened?

Thanks,
Edward

As an update. I just checked a couple of new installations on MySQL they all work fine.
I check another new installation using PostgreSQL and I am getting the same error message?
It looks like this is unique to PostgreSQL.

Thanks,
Edward

I’m not familiar enough with Postgres to know what it is choking on, but I would be curious…

The latest dev has these optimizations:

Can you try patching to see if the Postgres error is resolved with the latest code?

@ctgraham,

I applied these two patches and it fixed the issue. I was able to get into → Stats & Reports.
I was able to create a report.

Thanks,
Edward