Hi Diego, I think a better solution would be to expose the existing passwordFromFile() code through a new public libpq API, perhaps PQpassfileLookup().
Then pgcli could look up the password using the original host and port, and connect to the local tunnel port with that password. This would avoid both a new connection parameter and a separate .pgpass parser in each client. I would be happy to review such a patch. I think this would be a useful addition to PostgreSQL. Best regards, Denis Smirnov
