>On 05/29/2018 12:14 PM, nageswara Bandla wrote: > >> As per the link- >> (https://www.postgresql.org/docs/9.6/static/libpq-pgpass.html) I set >> PGPASSFILE environment variable to point to pgpass.conf location. Even >> then, it’s throwing same above error message. I have found out that >> pgagent is not reading pgpass.conf file when configured under >> LocalSystem account. >> >> When I change the properties of the pgagent service to run under my >> login user account. Then, it’s reading pgpass.conf file under >> %APPDATA%/postgresql/pgpass.conf. >> >> I am clueless, why pgagent is not honoring PGPASSFILE env variable. > >My guess because the LocalSystem user does not have permissions on your: > >%APPDATA%/postgresql/pgpass.conf > >file. This seems to be confirmed by it working when you run pgagent as >the login user.
It should be able to read files belonging to any user.
But the LocalSystem account can see only *global* environment variables ... it can't see any user specific ones. I would check if the PGPASSFILE variable is set globally or only in the user account.
I don't know anything specifically about running pgagent on Windows, so I can't say why it is giving an error if the docs say it should not.
I am setting the PGPASSFILE in system environment variables. I am not setting it in user specific environmental variables.
George
>passfile > > Specifies the name of the file used to store passwords (see Section >33.15). Defaults to ~/.pgpass, or %APPDATA%\postgresql\pgpass.conf on >Microsoft Windows. (No error is reported if this file does not exist.) > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^