Reputation: 2578
Can someone point me to a piece of documentation that specifies the matching rules psql applies to the .pgpass file? I always spend a few extra keystrokes trying to find the right combination of host, port, database, username to get it to connect.
Some things are obvious (i.e. if my linux username is not the same as my postgres username than I need to specify it) but based on what I've seen there is some non-obvious behavior.
Upvotes: 0
Views: 2757
Reputation: 34766
Here is the documentation you are probably looking for. It explains the rules pretty well.
Just so this isn't a link-only answer, here are the rules:
hostname:port:database:username:password
*
) for each field except passwordYou can use for instance localhost:*:*:foo:password
to specify password for user foo on your local machine regardless of the database you are connecting to or the port the Postgres is actually running on.
Upvotes: 5