fix upgrade scripts for PostgreSQL 8.4 compatibility
Merge pull request #2529 from mtbc/upgrade-fix-old-postgres

fix upgrade scripts for PostgreSQL 8.4 compatibility