Fixed wrong assumption of how passwords are used by psql.
Added helper function to change running environment of psql