This is based on https://communities.ca.com/community/ca-apm/blog/2017/12/14/em-installation-sometimes-fails-because-postgres-installation-hangs?et=watches.email.blog
There are two Postgres installation hanging scenarios:
Scenario #1: Postgres Database Installation Timeout.
When installing the Enterprise Manager, the installation completes with database creation failures. Investigation shows that the installer got timed out due to Postgres database installation taking longer than acceptable. Further review finds that the Postgres Database eventually started, but the APM DB schema is not created.
Scenario #2: Postgres Database Installation Stuck.
When installing the Enterprise Manager, the installation never completes. Investigation shows that the installer hangs due to the Postgres database installer. Further review finds that the EM installation hangs due to Postgres database installation stuck running validateuser.exe process.