In a fresh install from a few days ago, the second line of my pg_hba.conf
is
local all all peer
I believe this is the one that makes your connection attempt fail.makes your connection attempt fail.
The order of rules matter here: the first one that matches the access method, username, database name and source IP range will be considered. If it fails, then there is no second try, so the connection attempt will likely fail. Or, as the documentation states:
There is no "fall-through" or "backup": if one record is chosen and the authentication fails, subsequent records are not considered. If no record matches, access is denied.
The solution is easy: either remove the above line if you don't plan to use peer
authentication, or move your specific rule above this one.