- publishing free software manuals
The PostgreSQL 9.0 Reference Manual - Volume 2 - Programming Guide
by The PostgreSQL Global Development Group
Paperback (6"x9"), 478 pages
ISBN 9781906966065
RRP £14.95 ($19.95)

Sales of this book support the PostgreSQL project! Get a printed copy>>>

1.15 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.

The connection service file can be a per-user service file at ‘~/.pg_service.conf’ or the location specified by the environment variable PGSERVICEFILE, or it can be a system-wide file at ‘etc/pg_service.conf’ or in the directory specified by the environment variable PGSYSCONFDIR. If service definitions with the same name exist in the user and the system file, the user file takes precedence.

The file uses an “INI file” format where the section name is the service name and the parameters are connection parameters; see section 1.1 Database Connection Control Functions for a list. For example:

# comment
[mydb]
host=somehost
port=5433
user=admin

An example file is provided at ‘share/pg_service.conf.sample’.

ISBN 9781906966065The PostgreSQL 9.0 Reference Manual - Volume 2 - Programming GuideSee the print edition