-
+
The currently recognized parameter key words are:
-
+ id="libpq-connect-host" xreflabel="host">
host
-
+ id="libpq-connect-hostaddr" xreflabel="hostaddr">
hostaddr
-
+ id="libpq-connect-port" xreflabel="port">
port
-
+ id="libpq-connect-dbname" xreflabel="dbname">
dbname
-
+ id="libpq-connect-user" xreflabel="user">
user
-
+ id="libpq-connect-password" xreflabel="password">
password
-
+ id="libpq-connect-connect-timeout" xreflabel="connect_timeout">
connect_timeout
-
+ id="libpq-connect-options" xreflabel="options">
options
- Command-line options to be sent to the server.
+ Adds command-line options to send to the server at run-time.
+ For example, setting this to -c geqo=off> sets the
+ session's value of the geqo> parameter to
+ off>. For a detailed discussion of the available
+ options, consult .
-
+ id="libpq-connect-tty" xreflabel="tty">
tty
-
+ id="libpq-connect-sslmode" xreflabel="sslmode">
sslmode
-
+ id="libpq-connect-sslverify" xreflabel="sslverify">
sslverify
-
+ id="libpq-connect-requiressl" xreflabel="requiressl">
requiressl
-
+ id="libpq-connect-sslcert" xreflabel="sslcert">
sslcert
-
+ id="libpq-connect-sslkey" xreflabel="sslkey">
sslkey
-
+ id="libpq-connect-sslrootcert" xreflabel="sslrootcert">
sslrootcert
-
+ id="libpq-connect-sslcrl" xreflabel="sslcrl">
sslcrl
-
+ id="libpq-connect-krbsrvname" xreflabel="krbsrvname">
krbsrvname
-
+ id="libpq-connect-gsslib" xreflabel="gsslib">
gsslib
-
+ id="libpq-connect-service" xreflabel="service">
service
- PGHOST sets the database server name.
- If this begins with a slash, it specifies Unix-domain communication
- rather than TCP/IP communication; the value is then the name of the
- directory in which the socket file is stored (in a default installation
- setup this would be /tmp).
+
PGHOST behaves the same as
+ linkend="libpq-connect-host"> connection parameter.
- PGHOSTADDR specifies the numeric IP address of the database
- server. This can be set instead of or in addition to PGHOST
- to avoid DNS lookup overhead. See the documentation of
- these parameters, under PQconnectdb above, for details
- on their interaction.
-
- When neither PGHOST nor PGHOSTADDR is set,
- the default behavior is to connect using a local Unix-domain socket; or on
- machines without Unix-domain sockets,
libpq will
- attempt to connect to localhost>.
+
PGHOSTADDR behaves the same as
+ linkend="libpq-connect-hostaddr"> connection parameter.
+ This can be set instead of or in addition to PGHOST
+ to avoid DNS lookup overhead.
- PGPORT sets the TCP port number or Unix-domain socket
- file extension for communicating with the
+
PGPORT behaves the same as
+ linkend="libpq-connect-port"> connection parameter.
- PGDATABASE sets the
-
PostgreSQL database name.
-
+ PGDATABASE behaves the same as
+ linkend="libpq-connect-dbname"> connection parameter.
+
- PGUSER sets the user name used to connect to the
+
PGUSER behaves the same as
+ linkend="libpq-connect-user"> connection parameter.
database.
- PGPASSWORD sets the password used if the server
- demands password authentication. Use of this environment variable
+
PGPASSWORD behaves the same as
+ linkend="libpq-connect-password"> connection parameter.
+ Use of this environment variable
is not recommended for security reasons (some operating systems
allow non-root users to see process environment variables via
-
ps>); instead consider using the
+
ps>); instead consider using the
~/.pgpass> file (see ).
- PGSERVICE
- sets the service name to be looked up in
- pg_service.conf. This offers a shorthand way
- of setting all the parameters.
+
PGSERVICE behaves the same as
+ linkend="libpq-connect-service"> connection parameter.
- PGREALM sets the Kerberos realm to use with
+ PGREALM sets the Kerberos realm to use with
PostgreSQL, if it is different from the
local realm. If PGREALM is set,
-
libpq applications
will attempt
+
libpq applications
will attempt
authentication with servers for this realm and use separate ticket
- files to avoid conflicts with local ticket files. This
+ files to avoid conflicts with local ticket files. This
environment variable is only used if Kerberos authentication is
selected by the server.
- PGOPTIONS sets additional run-time options for the
-
PostgreSQL server. For example, setting
- PGOPTIONS to -c geqo=off> sets the session's
- value of the geqo> parameter to off>.
- For a detailed discussion of the available options consult
- linkend="runtime-config">.
+
PGOPTIONS behaves the same as
+ linkend="libpq-connect-options"> connection parameter.
- PGSSLMODE determines whether and with what priority
- an
SSL> connection will be negotiated with the server.
- There are four modes: disable> will attempt only an
- unencrypted
SSL> connection; allow> will
- negotiate, trying first a non-
SSL> connection, then if
- that fails, trying an
SSL> connection; prefer>
- (the default) will negotiate, trying first an
SSL>
- connection, then if that fails, trying a regular non-
SSL>
- connection;
require> will try only an SSL>
- connection. If
PostgreSQL> is compiled without SSL
- support, using option require> will cause an error, while
- options allow> and prefer> will be accepted
- but
libpq> will not in fact attempt an SSL>
- connection.
+
PGSSLMODE behaves the same as
+ linkend="libpq-connect-sslmode"> connection parameter.
- PGSSLVERIFY controls how libpq verifies the certificate on the
- server when performing an
SSL> connection. There are
- three options: none> disables verification completely
- (not recommended!); cert> enables verification that
- the certificate chains to a known CA only; cn> will
- both verify that the certificate chains to a known CA and that
- the cn> attribute of the certificate matches the
- hostname the connection is being made to (default).
+
PGSSLVERIFY behaves the same as
+ linkend="libpq-connect-sslverify"> connection parameter.
- PGREQUIRESSL sets whether or not the connection must
- be made over
SSL. If set to
1
,
-
libpq> will refuse to connect if the server does not
- accept an
SSL connection (equivalent to
- sslmode> prefer>). This option is deprecated
- in favor of the sslmode> setting, and is only available
- if
PostgreSQL> is compiled with SSL support.
+
PGREQUIRESSL behaves the same as
+ linkend="libpq-connect-requiressl"> connection parameter.
- PGSSLCERT specifies the location for the client
- certificate to use if the server requests one.
+ PGSSLCERT behaves the same as
+ linkend="libpq-connect-sslcert"> connection parameter.
- PGSSLKEY specifies the location for the secret key
- used for the client certificate. It can either specify a filename
- that will be used instead of the default
- ~/.postgresql/postgresql.key>, or can specify an external
- engine (engines are
OpenSSL> loadable modules). The
- external engine specification should consist of a colon-separated
- engine name and an engine-specific key identifier.
+
PGSSLKEY behaves the same as
+ linkend="libpq-connect-sslkey"> connection parameter.
- PGSSLROOTCERT specifies the file name where the SSL
- root certificate is stored.
+ PGSSLROOTCERT behaves the same as
+ linkend="libpq-connect-sslrootcert"> connection parameter.
- PGSSLCRL specifies the file name where the SSL certificate
- revocation list is stored.
+ PGSSLCRL behaves the same as
+ linkend="libpq-connect-sslcrl"> connection parameter.
- PGKRBSRVNAME sets the Kerberos service name to use
- when authenticating with Kerberos 5 or GSSAPI.
+ PGKRBSRVNAME behaves the same as
+ linkend="libpq-connect-krbsrvname"> connection parameter.
- PGGSSLIB sets the GSS library to use for GSSAPI
- authentication.
+ PGGSSLIB behaves the same as
+ linkend="libpq-connect-gsslib"> connection parameter.
- PGCONNECT_TIMEOUT sets the maximum number of seconds
- that
libpq will wait when attempting to
- connect to the
PostgreSQL server. If
- unset or set to zero,
libpq will wait
- indefinitely. It is not recommended to set the timeout to less than
- 2 seconds.
+
PGCONNECT_TIMEOUT behaves the same as
+ linkend="libpq-connect-connect-timeout"> connection parameter.