Hotfix for ar aging history. The following syntax is not supported in …
PostgreSQL 8.3.4:

SELECT cast(a.transdate as date) transdate

Must be:

SELECT cast(a.transdate as date) as transdate