Re: [INTERFACES] libpq & user - Mailing list pgsql-interfaces

From Robert Knop
Subject Re: [INTERFACES] libpq & user
Date
Msg-id Pine.SOL.3.95.980715080309.8510A-100000@panisse.lbl.gov
Whole thread Raw
In response to Re: [INTERFACES] libpq & user  (Herouth Maoz <herouth@oumail.openu.ac.il>)
List pgsql-interfaces
> 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 ======


pgsql-interfaces by date:

Previous
From: Cyril Ferrand
Date:
Subject: JDBC JAVA interface
Next
From: "Thomas G. Lockhart"
Date:
Subject: Re: [INTERFACES] libpq & user