Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit08407c3

Browse files
committed
Doc: clarify location of libpq's default service file on Windows.
The documentation didn't specify the name of the per-user service fileon Windows, and extrapolating from the pattern used for other configfiles gave the wrong answer. The fact that it isn't consistent with theothers sure seems like a bug, but it's far too late to change that now;we'd just penalize people who worked it out in the past. So, simplydocument the true state of affairs.In passing, fix some gratuitous differences between the discussionsof the service file and the password file.Julien Rouhaud, per question from Dominique Devienne.Backpatch to all supported branches. I (tgl) also chose to back-patchthe part of commitba356a3 that touched libpq.sgml's description ofthe service file --- in hindsight, I'm not sure why I didn't do so atthe time, as it includes some fairly essential information.Discussion:https://postgr.es/m/CAFCRh-_mdLrh8eYVzhRzu4c8bAFEBn=rwoHOmFJcQOTsCy5nig@mail.gmail.com
1 parent0ebd20e commit08407c3

File tree

1 file changed

+40
-17
lines changed

1 file changed

+40
-17
lines changed

‎doc/src/sgml/libpq.sgml

Lines changed: 40 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -7454,9 +7454,11 @@ myEventProc(PGEventId evtId, void *evtInfo, void *passThrough)
74547454
<primary><envar>PGSERVICEFILE</envar></primary>
74557455
</indexterm>
74567456
<envar>PGSERVICEFILE</envar> specifies the name of the per-user
7457-
connection service file. If not set, it defaults
7458-
to <filename>~/.pg_service.conf</filename>
7457+
connection service file
74597458
(see <xref linkend="libpq-pgservice"/>).
7459+
Defaults to <filename>~/.pg_service.conf</filename>, or
7460+
<filename>%APPDATA%\postgresql\.pg_service.conf</filename> on
7461+
Microsoft Windows.
74607462
</para>
74617463
</listitem>
74627464

@@ -7716,11 +7718,11 @@ myEventProc(PGEventId evtId, void *evtInfo, void *passThrough)
77167718
The file <filename>.pgpass</filename> in a user's home directory can
77177719
contain passwords to
77187720
be used if the connection requires a password (and no password has been
7719-
specifiedotherwise). On Microsoft Windows the file is named
7721+
specified otherwise). On Microsoft Windows the file is named
77207722
<filename>%APPDATA%\postgresql\pgpass.conf</filename> (where
77217723
<filename>%APPDATA%</filename> refers to the Application Data subdirectory in
77227724
the user's profile).
7723-
Alternatively,a password file can be specified
7725+
Alternatively,the password file to use can be specified
77247726
using the connection parameter <xref linkend="libpq-connect-passfile"/>
77257727
or the environment variable <envar>PGPASSFILE</envar>.
77267728
</para>
@@ -7779,26 +7781,34 @@ myEventProc(PGEventId evtId, void *evtInfo, void *passThrough)
77797781
<para>
77807782
The connection service file allows libpq connection parameters to be
77817783
associated with a single service name. That service name can then be
7782-
specifiedby a libpq connection, and the associated settings will be
7784+
specifiedin a libpq connection string, and the associated settings will be
77837785
used. This allows connection parameters to be modified without requiring
7784-
a recompile of the libpq application. The service name can also be
7786+
a recompile of the libpq-using application. The service name can also be
77857787
specified using the <envar>PGSERVICE</envar> environment variable.
77867788
</para>
77877789

77887790
<para>
7789-
The connection service file can be a per-user service file
7790-
at <filename>~/.pg_service.conf</filename> or the location
7791-
specified by the environment variable <envar>PGSERVICEFILE</envar>,
7792-
or it can be a system-wide file
7793-
at <filename>`pg_config --sysconfdir`/pg_service.conf</filename> or in the directory
7794-
specified by the environment variable
7795-
<envar>PGSYSCONFDIR</envar>. If service definitions with the same
7796-
name exist in the user and the system file, the user file takes
7797-
precedence.
7791+
Service names can be defined in either a per-user service file or a
7792+
system-wide file. If the same service name exists in both the user
7793+
and the system file, the user file takes precedence.
7794+
By default, the per-user service file is named
7795+
<filename>~/.pg_service.conf</filename>.
7796+
On Microsoft Windows, it is named
7797+
<filename>%APPDATA%\postgresql\.pg_service.conf</filename> (where
7798+
<filename>%APPDATA%</filename> refers to the Application Data subdirectory
7799+
in the user's profile). A different file name can be specified by
7800+
setting the environment variable <envar>PGSERVICEFILE</envar>.
7801+
The system-wide file is named <filename>pg_service.conf</filename>.
7802+
By default it is sought in the <filename>etc</filename> directory
7803+
of the <productname>PostgreSQL</productname> installation
7804+
(use <literal>pg_config --sysconfdir</literal> to identify this
7805+
directory precisely). Another directory, but not a different file
7806+
name, can be specified by setting the environment variable
7807+
<envar>PGSYSCONFDIR</envar>.
77987808
</para>
77997809

78007810
<para>
7801-
The file uses an <quote>INI file</quote> format where the section
7811+
Either service file uses an <quote>INI file</quote> format where the section
78027812
name is the service name and the parameters are connection
78037813
parameters; see <xref linkend="libpq-paramkeywords"/> for a list. For
78047814
example:
@@ -7809,9 +7819,22 @@ host=somehost
78097819
port=5433
78107820
user=admin
78117821
</programlisting>
7812-
An example file is provided at
7822+
An example file is provided in
7823+
the <productname>PostgreSQL</productname> installation at
78137824
<filename>share/pg_service.conf.sample</filename>.
78147825
</para>
7826+
7827+
<para>
7828+
Connection parameters obtained from a service file are combined with
7829+
parameters obtained from other sources. A service file setting
7830+
overrides the corresponding environment variable, and in turn can be
7831+
overridden by a value given directly in the connection string.
7832+
For example, using the above service file, a connection string
7833+
<literal>service=mydb port=5434</literal> will use
7834+
host <literal>somehost</literal>, port <literal>5434</literal>,
7835+
user <literal>admin</literal>, and other parameters as set by
7836+
environment variables or built-in defaults.
7837+
</para>
78157838
</sect1>
78167839

78177840

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp