Hi,
I have exactly the same error. It happened when I did an upgrade of datastore from 10.5.1 to 10.6.1.
After the setup finished I got redirected to this page to upgrade the database: url:2443/arcgis/datastore/
My OS is win server 2012 R2 standard. Service account has full permissions on arcgisdatastore folder.
I have done fair number of enterprice GIS upgredes from 10.5.1 to 10.6.1 but never had this.
I noticed in the previous servers there is pgsql9.3.12 under arcgisdatastore folder. I dont know when this folder was added. Looking at the servers to come to upgrade I can see this folder doesnt exist with 10.5.1 datastore.
Any ideas?