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

Commit74c32f3

Browse files
committed
Improve FILES section of psql reference page.
Primarily, explain where to find the system-wide psqlrc file, per recentgripe from John Sutton. Do some general wordsmithing and improve themarkup, too.Also adjust psqlrc.sample so its comments about file location are somewhattrustworthy. (Not sure why we bother with this file when it's empty,but whatever.)Back-patch to 9.2 where the startup file naming scheme was last changed.
1 parentebde6c4 commit74c32f3

File tree

2 files changed

+41
-29
lines changed

2 files changed

+41
-29
lines changed

‎doc/src/sgml/ref/psql-ref.sgml

Lines changed: 37 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -3516,55 +3516,66 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
35163516
<refsect1>
35173517
<title>Files</title>
35183518

3519-
<itemizedlist>
3519+
<variablelist>
3520+
<varlistentry>
3521+
<term><filename>psqlrc</filename> and <filename>~/.psqlrc</filename></term>
35203522
<listitem>
35213523
<para>
3522-
Unless it is passed an <option>-X</option>
3523-
or <option>-c</option> option,
3524-
<application>psql</application> attempts to
3525-
read and execute commands from the system-wide
3526-
<filename>psqlrc</filename> file and the user's
3527-
<filename>~/.psqlrc</filename> file before starting up.
3528-
(On Windows, the user's startup file is named
3529-
<filename>%APPDATA%\postgresql\psqlrc.conf</filename>.)
3530-
See <filename><replaceable>PREFIX</>/share/psqlrc.sample</>
3531-
for information on setting up the system-wide file. It could be used
3532-
to set up the client or the server to taste (using the <command>\set
3533-
</command> and <command>SET</command> commands).
3524+
Unless it is passed an <option>-X</option> or <option>-c</option> option,
3525+
<application>psql</application> attempts to read and execute commands
3526+
from the system-wide startup file (<filename>psqlrc</filename>) and then
3527+
the user's personal startup file (<filename>~/.psqlrc</filename>), after
3528+
connecting to the database but before accepting normal commands.
3529+
These files can be used to set up the client and/or the server to taste,
3530+
typically with <command>\set</command> and <command>SET</command>
3531+
commands.
35343532
</para>
35353533
<para>
3536-
The location of the user's <filename>~/.psqlrc</filename> file can
3537-
also be set explicitly via the <envar>PSQLRC</envar> environment
3538-
setting.
3534+
The system-wide startup file is named <filename>psqlrc</filename> and is
3535+
sought in the installation's <quote>system configuration</> directory,
3536+
which is most reliably identified by running <literal>pg_config
3537+
--sysconfdir</>. By default this directory will be <filename>../etc/</>
3538+
relative to the directory containing
3539+
the <productname>PostgreSQL</productname> executables. The name of this
3540+
directory can be set explicitly via the <envar>PGSYSCONFDIR</envar>
3541+
environment variable.
3542+
</para>
3543+
<para>
3544+
The user's personal startup file is named <filename>.psqlrc</filename>
3545+
and is sought in the invoking user's home directory. On Windows, which
3546+
lacks such a concept, the personal startup file is named
3547+
<filename>%APPDATA%\postgresql\psqlrc.conf</filename>.
3548+
The location of the user's startup file can be set explicitly via
3549+
the <envar>PSQLRC</envar> environment variable.
35393550
</para>
3540-
</listitem>
3541-
3542-
<listitem>
35433551
<para>
3544-
Both the system-wide<filename>psqlrc</filename> file and the user's
3545-
<filename>~/.psqlrc</filename> filecan be made <application>psql</application>-version-specific
3552+
Both the system-widestartup file and the user's personal startup file
3553+
can be made <application>psql</application>-version-specific
35463554
by appending a dash and the <productname>PostgreSQL</productname>
3547-
major or minor<application>psql</application>release number,
3555+
major or minor release number to the file name,
35483556
for example <filename>~/.psqlrc-9.2</filename> or
35493557
<filename>~/.psqlrc-9.2.5</filename>. The most specific
35503558
version-matching file will be read in preference to a
35513559
non-version-specific file.
35523560
</para>
35533561
</listitem>
3562+
</varlistentry>
35543563

3564+
<varlistentry>
3565+
<term><filename>.psql_history</filename></term>
35553566
<listitem>
35563567
<para>
35573568
The command-line history is stored in the file
35583569
<filename>~/.psql_history</filename>, or
35593570
<filename>%APPDATA%\postgresql\psql_history</filename> on Windows.
35603571
</para>
35613572
<para>
3562-
The location of the history file can
3563-
also be set explicitly via the <envar>PSQL_HISTORY</envar> environment
3564-
setting.
3573+
The location of the history file can be set explicitly via
3574+
the <envar>PSQL_HISTORY</envar> environment variable.
35653575
</para>
35663576
</listitem>
3567-
</itemizedlist>
3577+
</varlistentry>
3578+
</variablelist>
35683579
</refsect1>
35693580

35703581

‎src/bin/psql/psqlrc.sample

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
--
2-
--psql configuration file
2+
--system-widepsql configuration file
33
--
44
-- This file is read before the .psqlrc file in the user's home directory.
55
--
6-
-- Copy this to your sysconf directory (typically /usr/local/pgsql/etc) and
7-
-- rename it psqlrc.
6+
-- Copy this to your installation's sysconf directory and rename it psqlrc.
7+
-- The sysconf directory can be identified via "pg_config --sysconfdir".
8+
--

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp