On 6/4/2018 6:31 PM, nageswara Bandla wrote:
I have figured out the issue with pgAgent both in Windows and Linux.
PgAgent seems to ignore pgpass.conf/.pgpass whenever it has 127.0.0.1 (127.0.0.1:5432:*:postgres:postgres) throws an error:
DEBUG: Creating DB connection: user=postgres port=5432 hostaddr=127.0.0.1 dbname=linuxpostgresdb
WARNING: Couldn't create the primary connection (attempt 1): fe_sendauth: no password supplied
The solution could be update .pgpass to have ( localhost:5432:*:postgres:postgres ) and then pgagent works fine without issues.
I think, pgagent is not inline with libpq.dll while passing host address parameter. I have raised this concern with pgagent github where exactly they need to change the code in order for pgagent to be in line with psql program.
Wow !!!
I don't use pgpass much at all - usually I want the security of providing the password manually. Since we started with the idea that the file wasn't being read properly, I was mainly trying to figure out how Windows could be screwing that up. <grin>
There is a difference between localhost and 127.0.0.1: localhost is DNS resolved - usually from the local hosts file - and thus works with either IPv4 or IPv6 addressing. But it never would have occurred to me that using one vs the other, on an otherwise properly configured system, should cause an error.
Great work finding that.
George