Your fix is probably the best one.Maybe this could be considered as a bug and back ported to previous versions...
RegardsPAscal
--Sent from: http://www.postgresql-archive.org/PostgreSQL-hackers-f1928748.html