Search code examples
postgresqlconnection-stringpg-restore

PostgreSQL PG_Restore accepts connection string but still prompts for a password


When running the following:

pg_restore.exe --dbname=postgresql://postgres:PASSWORD@localhost:5432 --create "FileName"

I am running into a problem where pg_restore prompts for a password. PG_Restore functions properly on one machine but not on others. This tells me that there is a settings issue somewhere. PGPass is blank on all machines.

Why would PG_Restore prompt the user for a password when a connection string, with the correct password, is passed into the executable?


Solution

  • The test system was using an older minor version of postgres (9.4.0). Once I upgraded this to 9.4.7 (replaced the binaries per documentation), the connection string worked exactly as expected.

    Edit: I also tested this on 9.4.6 and it worked fine.