Recently updated to JIRA 5.1.8, but was also seeing this in 5.0.3
Error appears to be due to this SQL statement:
SELECT DISTINCT ci.OLDVALUE, cg.CREATED FROM changeitem ci INNER JOIN changegroup cg ON ci.groupid=cg.ID WHERE cg.issueid=? AND ci.field='workflow'ORDER BY CREATED DESC
Not sure it's really affecting anything, but it's a little disconcerting.