1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
5 >Environment Variables</TITLE
8 CONTENT="Modular DocBook HTML Stylesheet Version 1.7"><LINK
10 HREF="mailto:pgsql-docs@postgresql.org"><LINK
12 TITLE="PostgreSQL 7.4.1 Documentation"
13 HREF="index.html"><LINK
15 TITLE="libpq - C Library"
16 HREF="libpq.html"><LINK
18 TITLE="Notice Processing"
19 HREF="libpq-notice-processing.html"><LINK
21 TITLE="The Password File"
22 HREF="libpq-pgpass.html"><LINK
25 HREF="stylesheet.css"><META
27 CONTENT="2003-12-22T03:48:47"></HEAD
33 SUMMARY="Header navigation table"
43 >PostgreSQL 7.4.1 Documentation</TH
51 HREF="libpq-notice-processing.html"
84 HREF="libpq-pgpass.html"
99 >27.10. Environment Variables</A
105 >The following environment variables can be used to select default
106 connection parameter values, which will be used by
117 > if no value is directly specified by the calling
118 code. These are useful to avoid hard-coding database connection
119 information into simple client applications, for example.
133 > sets the database server name.
134 If this begins with a slash, it specifies Unix-domain communication
135 rather than TCP/IP communication; the value is the name of the
136 directory in which the socket file is stored (default <TT
150 > specifies the numeric IP address of the database
151 server. This can be set instead of <TT
155 lookup overhead. See the documentation of
156 these parameters, under <CODE
160 on their interaction.</P
171 > sets the TCP port number or Unix-domain
172 socket file extension for communicating with the
203 sets the user name used to connect to the database.</P
215 sets the password used if the server demands password
216 authentication. This environment variable is deprecated for security
217 reasons; consider migrating to use the <TT
222 HREF="libpq-pgpass.html"
236 sets the service name to be looked up in <TT
240 This offers a shorthand way of setting all the parameters.</P
251 > sets the Kerberos realm to use with
255 >, if it is different from the local realm.
263 applications will attempt authentication with servers for this realm and use
264 separate ticket files to avoid conflicts with local
265 ticket files. This environment variable is only
266 used if Kerberos authentication is selected by the server.</P
277 > sets additional run-time options for
292 > determines whether and with what priority an
296 > connection will be negotiated with the server. There are
300 > will attempt only an unencrypted
308 trying first a non-<ACRONYM
311 > connection, then if that fails,
319 (the default) will negotiate, trying first an <ACRONYM
323 connection, then if that fails, trying a regular non-<ACRONYM
330 > will try only an <ACRONYM
337 > is compiled without SSL support,
341 > will cause an error, and options
348 > will be tolerated but
352 > will be unable to negotiate an <ACRONYM
367 > sets whether or not the connection must be
379 will refuse to connect if the server does not accept
383 > connection (equivalent to <TT
391 This option is deprecated in favor of the <TT
395 setting, and is only available if
399 > is compiled with SSL support.</P
409 >PGCONNECT_TIMEOUT</TT
410 > sets the maximum number of seconds
414 > will wait when attempting to
419 or set to zero, <SPAN
422 > will wait indefinitely.
423 It is not recommended to set the timeout to less than 2 seconds.</P
428 >The following environment variables can be used to specify default
429 behavior for each <SPAN
440 commands for ways to set default behavior on a per-user or per-database
456 sets the default style of date/time representation.
459 >SET datestyle TO ...</TT
472 sets the default time zone.
475 >SET timezone TO ...</TT
486 >PGCLIENTENCODING</TT
488 sets the default client character set encoding.
491 >SET client_encoding TO ...</TT
504 sets the default mode for the genetic query optimizer.
513 Refer to the <ACRONYM
520 for information on correct values for these environment variables.</P
527 SUMMARY="Footer navigation table"
538 HREF="libpq-notice-processing.html"
556 HREF="libpq-pgpass.html"
566 >Notice Processing</TD
580 >The Password File</TD