I have noticed recently a weird (at least to me) behaviour of
psql when trying to run
psql -l. The essential steps to reproduce it are:
- Create a sample DB (I did it with docker and created a simple role with a password)
Export environment variables that are used by
PGPASSWORD=password PGDATABASE=database PGUSER=username
pg_hba.conf. And instead of having the default for
localI replaced it with. Of course don't forget about reloading the configuration.
local database username trust
psqlworks as expected but running
psql -lresults in
psql: FATAL: no pg_hba.conf entry for host "[local]", user "username", database "database", SSL off
This seems to not take the environment variables into account when making a connection to the database.