aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2014-01-14 19:27:57 -0500
committerTom Lane <tgl@sss.pgh.pa.us>2014-01-14 19:28:09 -0500
commitaa00af38c802b527338f0f14177c148a0cfed05c (patch)
tree4bf868a7c96cf6ae68a0044ca9c9b00de32702b7
parentad2e041a3f4b0d3266b0848c0da6eadce7391316 (diff)
downloadpostgresql-aa00af38c802b527338f0f14177c148a0cfed05c.tar.gz
postgresql-aa00af38c802b527338f0f14177c148a0cfed05c.zip
Improve FILES section of psql reference page.
Primarily, explain where to find the system-wide psqlrc file, per recent gripe from John Sutton. Do some general wordsmithing and improve the markup, too. Also adjust psqlrc.sample so its comments about file location are somewhat trustworthy. (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.
-rw-r--r--doc/src/sgml/ref/psql-ref.sgml63
-rw-r--r--src/bin/psql/psqlrc.sample7
2 files changed, 41 insertions, 29 deletions
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 97317c3630f..5ae48b81a18 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -3420,42 +3420,53 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
<refsect1>
<title>Files</title>
- <itemizedlist>
+ <variablelist>
+ <varlistentry>
+ <term><filename>psqlrc</filename> and <filename>~/.psqlrc</filename></term>
<listitem>
<para>
- Unless it is passed an <option>-X</option>
- or <option>-c</option> option,
- <application>psql</application> attempts to
- read and execute commands from the system-wide
- <filename>psqlrc</filename> file and the user's
- <filename>~/.psqlrc</filename> file before starting up.
- (On Windows, the user's startup file is named
- <filename>%APPDATA%\postgresql\psqlrc.conf</filename>.)
- See <filename><replaceable>PREFIX</>/share/psqlrc.sample</>
- for information on setting up the system-wide file. It could be used
- to set up the client or the server to taste (using the <command>\set
- </command> and <command>SET</command> commands).
+ Unless it is passed an <option>-X</option> or <option>-c</option> option,
+ <application>psql</application> attempts to read and execute commands
+ from the system-wide startup file (<filename>psqlrc</filename>) and then
+ the user's personal startup file (<filename>~/.psqlrc</filename>), after
+ connecting to the database but before accepting normal commands.
+ These files can be used to set up the client and/or the server to taste,
+ typically with <command>\set</command> and <command>SET</command>
+ commands.
</para>
<para>
- The location of the user's <filename>~/.psqlrc</filename> file can
- also be set explicitly via the <envar>PSQLRC</envar> environment
- setting.
+ The system-wide startup file is named <filename>psqlrc</filename> and is
+ sought in the installation's <quote>system configuration</> directory,
+ which is most reliably identified by running <literal>pg_config
+ --sysconfdir</>. By default this directory will be <filename>../etc/</>
+ relative to the directory containing
+ the <productname>PostgreSQL</productname> executables. The name of this
+ directory can be set explicitly via the <envar>PGSYSCONFDIR</envar>
+ environment variable.
+ </para>
+ <para>
+ The user's personal startup file is named <filename>.psqlrc</filename>
+ and is sought in the invoking user's home directory. On Windows, which
+ lacks such a concept, the personal startup file is named
+ <filename>%APPDATA%\postgresql\psqlrc.conf</filename>.
+ The location of the user's startup file can be set explicitly via
+ the <envar>PSQLRC</envar> environment variable.
</para>
- </listitem>
-
- <listitem>
<para>
- Both the system-wide <filename>psqlrc</filename> file and the user's
- <filename>~/.psqlrc</filename> file can be made <application>psql</application>-version-specific
+ Both the system-wide startup file and the user's personal startup file
+ can be made <application>psql</application>-version-specific
by appending a dash and the <productname>PostgreSQL</productname>
- major or minor <application>psql</application> release number,
+ major or minor release number to the file name,
for example <filename>~/.psqlrc-9.2</filename> or
<filename>~/.psqlrc-9.2.5</filename>. The most specific
version-matching file will be read in preference to a
non-version-specific file.
</para>
</listitem>
+ </varlistentry>
+ <varlistentry>
+ <term><filename>.psql_history</filename></term>
<listitem>
<para>
The command-line history is stored in the file
@@ -3463,12 +3474,12 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
<filename>%APPDATA%\postgresql\psql_history</filename> on Windows.
</para>
<para>
- The location of the history file can
- also be set explicitly via the <envar>PSQL_HISTORY</envar> environment
- setting.
+ The location of the history file can be set explicitly via
+ the <envar>PSQL_HISTORY</envar> environment variable.
</para>
</listitem>
- </itemizedlist>
+ </varlistentry>
+ </variablelist>
</refsect1>
diff --git a/src/bin/psql/psqlrc.sample b/src/bin/psql/psqlrc.sample
index 6054fabb380..8152cace2b0 100644
--- a/src/bin/psql/psqlrc.sample
+++ b/src/bin/psql/psqlrc.sample
@@ -1,7 +1,8 @@
--
--- psql configuration file
+-- system-wide psql configuration file
--
-- This file is read before the .psqlrc file in the user's home directory.
--
--- Copy this to your sysconf directory (typically /usr/local/pgsql/etc) and
--- rename it psqlrc.
+-- Copy this to your installation's sysconf directory and rename it psqlrc.
+-- The sysconf directory can be identified via "pg_config --sysconfdir".
+--