corems_json: fix to run on Postgres 8.4.1