You need to upgrade PostgreSQL before you can upgrade xTuple.
IF NOT EXISTS was added to
CREATE INDEX in PostgreSQL 9.5, which is the minimum supported version for xTuple 4.12.x and above.
Other people may have differing opinions on the process, but I ignore
pg_upgrade, and instead install the newer PostgreSQL alongside the existing one but on a different TCP port. Use
pg_dumpall on the old then
psql on the new, remembering to install plv8 on the new instance. Once done you can just stop both instances, swap their ports (put the new version on the original port) and then start it up. This way you keep the old instance as is for a little while, and you don't have to reconfigure clients with any new connection info.