17th September 2020: PostgreSQL 13 RC 1 Released!
Supported Versions: Current (12) / 11 / 10 / 9.6 / 9.5
Development Versions: 13 / devel
Unsupported versions: 9.4 / 9.3 / 9.2 / 9.1 / 9.0 / 8.4 / 8.3 / 8.2 / 8.1
This documentation is for an unsupported version of PostgreSQL.
You may want to view the same page for the current version, or one of the supported versions listed above instead.

30.14. The Connection Service File

The connection service file allows libpq connection parameters to be associated with a single service name. That service name can then be specified by a libpq connection, and the associated settings will be used. This allows connection parameters to be modified without requiring a recompile of the libpq application. The service name can also be specified using the PGSERVICE environment variable.

To use this feature, copy share/pg_service.conf.sample to etc/pg_service.conf and edit the file to add service names and parameters. This file can be used for client-only installs too. The file's location can also be specified by the PGSYSCONFDIR environment variable.