> In the psql source code, they set the user by setting the PGUSER
> environment variable. The source of the PQsetdb function states that the
> following environment variables are accepted (although this is not
> documented - at least not in my old 6.2.1 version):
Aha! Thank you, that was the secret. I do not believe that these
environment variables are documented in 6.3.1 either -- at least, I didn't
find them. I tried USER, but not PGUSER. Setting PGUSER worked.
> Another option: the psql source, when needing a password, uses the
> undocumented function:
>
> PQconnectdb( connection_string );
>
> The connection string is a C character string containing pairs of names and
> values. For example: "host=dara user=deep password=ocean dbname=deep".
This is how the Pg.pm perl connectdb function works; that _is_ documented
in the Pg man page. Presumably this is a "documented" feature of libpq,
but the documentation hasn't caught up yet. (Of course, it's always scary
to assume things like that.)
Thanks again for your help.
-Rob
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
==== Rob Knop ===== rknop@lbl.gov ====== http://panisse.lbl.gov/~rknop ======