fix upgrade scripts for PostgreSQL 8.4 compatibility