@@ -7216,9 +7216,11 @@ myEventProc(PGEventId evtId, void *evtInfo, void *passThrough)
7216
7216
<primary><envar>PGSERVICEFILE</envar></primary>
7217
7217
</indexterm>
7218
7218
<envar>PGSERVICEFILE</envar> specifies the name of the per-user
7219
- connection service file. If not set, it defaults
7220
- to <filename>~/.pg_service.conf</>
7219
+ connection service file
7221
7220
(see <xref linkend="libpq-pgservice">).
7221
+ Defaults to <filename>~/.pg_service.conf</filename>, or
7222
+ <filename>%APPDATA%\postgresql\.pg_service.conf</filename> on
7223
+ Microsoft Windows.
7222
7224
</para>
7223
7225
</listitem>
7224
7226
@@ -7468,11 +7470,11 @@ myEventProc(PGEventId evtId, void *evtInfo, void *passThrough)
7468
7470
The file <filename>.pgpass</filename> in a user's home directory can
7469
7471
contain passwords to
7470
7472
be used if the connection requires a password (and no password has been
7471
- specified otherwise). On Microsoft Windows the file is named
7472
- <filename>%APPDATA%\postgresql\pgpass.conf</> (where
7473
- <filename>%APPDATA%</> refers to the Application Data subdirectory in
7473
+ specified otherwise). On Microsoft Windows the file is named
7474
+ <filename>%APPDATA%\postgresql\pgpass.conf</filename > (where
7475
+ <filename>%APPDATA%</filename > refers to the Application Data subdirectory in
7474
7476
the user's profile).
7475
- Alternatively, a password file can be specified
7477
+ Alternatively, the password file to use can be specified
7476
7478
using the connection parameter <xref linkend="libpq-connect-passfile">
7477
7479
or the environment variable <envar>PGPASSFILE</envar>.
7478
7480
</para>
@@ -7531,26 +7533,34 @@ myEventProc(PGEventId evtId, void *evtInfo, void *passThrough)
7531
7533
<para>
7532
7534
The connection service file allows libpq connection parameters to be
7533
7535
associated with a single service name. That service name can then be
7534
- specified by a libpq connection, and the associated settings will be
7536
+ specified in a libpq connection string , and the associated settings will be
7535
7537
used. This allows connection parameters to be modified without requiring
7536
- a recompile of the libpq application. The service name can also be
7538
+ a recompile of the libpq-using application. The service name can also be
7537
7539
specified using the <envar>PGSERVICE</envar> environment variable.
7538
7540
</para>
7539
7541
7540
7542
<para>
7541
- The connection service file can be a per-user service file
7542
- at <filename>~/.pg_service.conf</filename> or the location
7543
- specified by the environment variable <envar>PGSERVICEFILE</envar>,
7544
- or it can be a system-wide file
7545
- at <filename>`pg_config --sysconfdir`/pg_service.conf</filename> or in the directory
7546
- specified by the environment variable
7547
- <envar>PGSYSCONFDIR</envar>. If service definitions with the same
7548
- name exist in the user and the system file, the user file takes
7549
- precedence.
7543
+ Service names can be defined in either a per-user service file or a
7544
+ system-wide file. If the same service name exists in both the user
7545
+ and the system file, the user file takes precedence.
7546
+ By default, the per-user service file is named
7547
+ <filename>~/.pg_service.conf</filename>.
7548
+ On Microsoft Windows, it is named
7549
+ <filename>%APPDATA%\postgresql\.pg_service.conf</filename> (where
7550
+ <filename>%APPDATA%</filename> refers to the Application Data subdirectory
7551
+ in the user's profile). A different file name can be specified by
7552
+ setting the environment variable <envar>PGSERVICEFILE</envar>.
7553
+ The system-wide file is named <filename>pg_service.conf</filename>.
7554
+ By default it is sought in the <filename>etc</filename> directory
7555
+ of the <productname>PostgreSQL</productname> installation
7556
+ (use <literal>pg_config --sysconfdir</literal> to identify this
7557
+ directory precisely). Another directory, but not a different file
7558
+ name, can be specified by setting the environment variable
7559
+ <envar>PGSYSCONFDIR</envar>.
7550
7560
</para>
7551
7561
7552
7562
<para>
7553
- The file uses an <quote>INI file</quote> format where the section
7563
+ Either service file uses an <quote>INI file</quote> format where the section
7554
7564
name is the service name and the parameters are connection
7555
7565
parameters; see <xref linkend="libpq-paramkeywords"> for a list. For
7556
7566
example:
@@ -7561,9 +7571,22 @@ host=somehost
7561
7571
port=5433
7562
7572
user=admin
7563
7573
</programlisting>
7564
- An example file is provided at
7574
+ An example file is provided in
7575
+ the <productname>PostgreSQL</productname> installation at
7565
7576
<filename>share/pg_service.conf.sample</filename>.
7566
7577
</para>
7578
+
7579
+ <para>
7580
+ Connection parameters obtained from a service file are combined with
7581
+ parameters obtained from other sources. A service file setting
7582
+ overrides the corresponding environment variable, and in turn can be
7583
+ overridden by a value given directly in the connection string.
7584
+ For example, using the above service file, a connection string
7585
+ <literal>service=mydb port=5434</literal> will use
7586
+ host <literal>somehost</literal>, port <literal>5434</literal>,
7587
+ user <literal>admin</literal>, and other parameters as set by
7588
+ environment variables or built-in defaults.
7589
+ </para>
7567
7590
</sect1>
7568
7591
7569
7592
0 commit comments