3.2. Control and Initialization

3.2.1. Environment Variables

The following environment variables can be used to set up default values for an environment and to avoid hard-coding database names into an application program:

Note: Refer to Section 1.10 for a complete list of available connection options.

The following environment variables can be used to select default connection parameter values, which will be used by PQconnectdb or PQsetdbLogin if no value is directly specified by the calling code. These are useful to avoid hard-coding database names into simple application programs.

Note: libpq++ uses only environment variables or libpq's PQconnectdb conninfo style strings.

The following environment variables can be used to specify user-level default behavior for every PostgreSQL session:

The following environment variables can be used to specify default internal behavior for every PostgreSQL session:

Refer to the SET SQL command for information on correct values for these environment variables.