Sorry about that. The correct coercion path is text => integer:
openacs4=# select '4'::varchar::integer;
ERROR: Cannot cast type 'varchar' to 'int4'
openacs4=# select '4'::text::integer;
?column?
----------
4
(1 row)
What version are you guys using? I tested the above fix, so I assumed that it worked ok.
In general, you should avoid joins with acs_objects due to performance considerations.