To fix a local Ambari/PostgreSQL upgrade:
Repair metadata information.
/var/lib/ambari-server/resources/upgrade/dml/Ambari-DML-Oracle-INSERT_METAINFO.sql with the following parameters: argument #1 = repo:/HDP/<version>/<os>/<repoid>:baseurl argument #2 = <baseurl>
Run the fix script.
/var/lib/ambari-server/resources/upgrade/dml/Ambari-DML-Oracle-FIX_LOCAL_REPO.sql