select open change scope Open full search

PG.CENTER connects PostgreSQL documentation, reference, and ecosystem knowledge. Maintained by Pigsty.

Unsupported versions: 6.3
Historical version. PostgreSQL 6.3 reached end of support in March 2003. See the current manual for supported releases.
PostgreSQL
Prev Chapter 40. libpq Next

Control and Initialization

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

  • PGHOST sets the default server name.

  • PGOPTIONS sets additional runtime options for the Postgres backend.

  • PGPORT sets the default port for communicating with the Postgres backend.

  • PGTTY sets the file or tty on which debugging messages from the backend server are displayed.

  • PGDATABASE sets the default Postgres database name.

  • PGREALM sets the Kerberos realm to use with Postgres, if it is different from the local realm. If PGREALM is set, Postgres applications will attempt authentication with servers for this realm and use separate ticket files to avoid conflicts with local ticket files. This environment variable is only used if Kerberos authentication is enabled.


Prev Home Next
libpq Up Database Connection Functions

Report a documentation issue

Read the upstream documentation. For corrections, first check the current manual.