February 2011
The PostgreSQL Wiki shows that the environment variables PGUSER and PGPASSWORD can be used, as well as a file ~/.pgpass (or anything referenced by PGPASSFILE), with the format:
hostname:port:database:username:password