@@ -7103,9 +7103,11 @@ myEventProc(PGEventId evtId, void *evtInfo, void *passThrough)
7103
7103
<primary><envar>PGSERVICEFILE</envar></primary>
7104
7104
</indexterm>
7105
7105
<envar>PGSERVICEFILE</envar> specifies the name of the per-user
7106
- connection service file. If not set, it defaults
7107
- to <filename>~/.pg_service.conf</filename>
7106
+ connection service file
7108
7107
(see <xref linkend="libpq-pgservice"/>).
7108
+ Defaults to <filename>~/.pg_service.conf</filename>, or
7109
+ <filename>%APPDATA%\postgresql\.pg_service.conf</filename> on
7110
+ Microsoft Windows.
7109
7111
</para>
7110
7112
</listitem>
7111
7113
@@ -7385,11 +7387,11 @@ myEventProc(PGEventId evtId, void *evtInfo, void *passThrough)
7385
7387
The file <filename>.pgpass</filename> in a user's home directory can
7386
7388
contain passwords to
7387
7389
be used if the connection requires a password (and no password has been
7388
- specified otherwise). On Microsoft Windows the file is named
7390
+ specified otherwise). On Microsoft Windows the file is named
7389
7391
<filename>%APPDATA%\postgresql\pgpass.conf</filename> (where
7390
7392
<filename>%APPDATA%</filename> refers to the Application Data subdirectory in
7391
7393
the user's profile).
7392
- Alternatively, a password file can be specified
7394
+ Alternatively, the password file to use can be specified
7393
7395
using the connection parameter <xref linkend="libpq-connect-passfile"/>
7394
7396
or the environment variable <envar>PGPASSFILE</envar>.
7395
7397
</para>
@@ -7448,26 +7450,34 @@ myEventProc(PGEventId evtId, void *evtInfo, void *passThrough)
7448
7450
<para>
7449
7451
The connection service file allows libpq connection parameters to be
7450
7452
associated with a single service name. That service name can then be
7451
- specified by a libpq connection, and the associated settings will be
7453
+ specified in a libpq connection string , and the associated settings will be
7452
7454
used. This allows connection parameters to be modified without requiring
7453
- a recompile of the libpq application. The service name can also be
7455
+ a recompile of the libpq-using application. The service name can also be
7454
7456
specified using the <envar>PGSERVICE</envar> environment variable.
7455
7457
</para>
7456
7458
7457
7459
<para>
7458
- The connection service file can be a per-user service file
7459
- at <filename>~/.pg_service.conf</filename> or the location
7460
- specified by the environment variable <envar>PGSERVICEFILE</envar>,
7461
- or it can be a system-wide file
7462
- at <filename>`pg_config --sysconfdir`/pg_service.conf</filename> or in the directory
7463
- specified by the environment variable
7464
- <envar>PGSYSCONFDIR</envar>. If service definitions with the same
7465
- name exist in the user and the system file, the user file takes
7466
- precedence.
7460
+ Service names can be defined in either a per-user service file or a
7461
+ system-wide file. If the same service name exists in both the user
7462
+ and the system file, the user file takes precedence.
7463
+ By default, the per-user service file is named
7464
+ <filename>~/.pg_service.conf</filename>.
7465
+ On Microsoft Windows, it is named
7466
+ <filename>%APPDATA%\postgresql\.pg_service.conf</filename> (where
7467
+ <filename>%APPDATA%</filename> refers to the Application Data subdirectory
7468
+ in the user's profile). A different file name can be specified by
7469
+ setting the environment variable <envar>PGSERVICEFILE</envar>.
7470
+ The system-wide file is named <filename>pg_service.conf</filename>.
7471
+ By default it is sought in the <filename>etc</filename> directory
7472
+ of the <productname>PostgreSQL</productname> installation
7473
+ (use <literal>pg_config --sysconfdir</literal> to identify this
7474
+ directory precisely). Another directory, but not a different file
7475
+ name, can be specified by setting the environment variable
7476
+ <envar>PGSYSCONFDIR</envar>.
7467
7477
</para>
7468
7478
7469
7479
<para>
7470
- The file uses an <quote>INI file</quote> format where the section
7480
+ Either service file uses an <quote>INI file</quote> format where the section
7471
7481
name is the service name and the parameters are connection
7472
7482
parameters; see <xref linkend="libpq-paramkeywords"/> for a list. For
7473
7483
example:
@@ -7478,9 +7488,22 @@ host=somehost
7478
7488
port=5433
7479
7489
user=admin
7480
7490
</programlisting>
7481
- An example file is provided at
7491
+ An example file is provided in
7492
+ the <productname>PostgreSQL</productname> installation at
7482
7493
<filename>share/pg_service.conf.sample</filename>.
7483
7494
</para>
7495
+
7496
+ <para>
7497
+ Connection parameters obtained from a service file are combined with
7498
+ parameters obtained from other sources. A service file setting
7499
+ overrides the corresponding environment variable, and in turn can be
7500
+ overridden by a value given directly in the connection string.
7501
+ For example, using the above service file, a connection string
7502
+ <literal>service=mydb port=5434</literal> will use
7503
+ host <literal>somehost</literal>, port <literal>5434</literal>,
7504
+ user <literal>admin</literal>, and other parameters as set by
7505
+ environment variables or built-in defaults.
7506
+ </para>
7484
7507
</sect1>
7485
7508
7486
7509
0 commit comments