Tom Lane wrote:
----------------->>>>
Use the pg_connect -conninfo style, -conninfo "user=foo dbname=bar ..."
The other syntax is obsolete and not really being supported.
----------------->>>>
The following solved my problem:
pg_connect -conninfo "host=$PGHostName user=$PGUserName dbname=$PGDBName"