"David G. Johnston" <david.g.johnston@gmail.com> writes:
> Your original email demonstrates that, absent -h localhost, psql is looking
> for and finding a local socket and thus the first matching entry is a
> "local" one which does not require password entry because it is set for
> "peer". This is working as intended.
Indeed. If you don't like the results you're getting, you need to go
adjust your pg_hba.conf file. Right now, you've got it set to apply
different authentication rules for Unix-socket and localhost connections,
and you apparently don't want that.
regards, tom lane