identifier to the file name,
for example <filename>~/.psqlrc-&majorversion;</filename> or
<filename>~/.psqlrc-&version;</filename>.
The most specific version-matching file will be read in preference
to a non-version-specific file.
These version suffixes are added after determining the file path
as explained above.
</para>
</listitem>
</varlistentry>
<varlistentry id="app-psql-files-psql-history">
<term><filename>.psql_history</filename></term>
<listitem>
<para>
The command-line history is stored in the file
<filename>~/.psql_history</filename>, or
<filename>%APPDATA%\postgresql\psql_history</filename> on Windows.
</para>
<para>
The location of the history file can be set explicitly via
the <varname>HISTFILE</varname> <application>psql</application> variable or
the <envar>PSQL_HISTORY</envar> environment variable.
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1>
<title>Notes</title>
<itemizedlist>
<listitem>
<para><application>psql</application> works best with servers of the same
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
work with servers of versions back to 9.2, though not necessarily with
servers newer than <application>psql</application> itself. The general
functionality of running SQL commands and displaying query results
should also work with servers of a newer major version, but this cannot
be guaranteed in all cases.
</para>
<para>
If you want to use <application>psql</application> to connect to several
servers of different major versions, it is recommended that you use the
newest version of <application>psql</application>. Alternatively, you
can keep around a copy of <application>psql</application> from each
major version and be sure to use the version that matches the
respective server. But in practice, this additional complication should
not be necessary.
</para>
</listitem>
<listitem>
<para>
Before <productname>PostgreSQL</productname> 9.6,
the <option>-c</option> option implied <option>-X</option>
(<option>--no-psqlrc</option>); this is no longer the case.
</para>
</listitem>
<listitem>
<para>
Before <productname>PostgreSQL</productname> 8.4,
<application>psql</application> allowed the
first argument of a single-letter backslash command to start
directly after the command, without intervening whitespace.
Now, some whitespace is required.
</para>
</listitem>
</itemizedlist>
</refsect1>
<refsect1>
<title>Notes for Windows Users</title>
<para>
<application>psql</application> is built as a <quote>console
application</quote>. Since the Windows console windows use a different
encoding than the rest of the system, you must take special care
when using 8-bit characters within <application>psql</application>.
If <application>psql</application> detects a problematic
console code page, it will warn you at startup. To change the
console code page, two things are necessary:
<itemizedlist>
<listitem>
<para>
Set the code page by entering <userinput>cmd.exe /c chcp
1252</userinput>. (1252 is a code page that is appropriate for
German; replace it with your value.) If you are using Cygwin,
you can put this command in <filename>/etc/profile</filename>.
</para>
</listitem>
<listitem>
<para>
Set the console font to <literal>Lucida Console</literal>, because the
raster font does not work with the ANSI code page.
</para>
</listitem>
</itemizedlist></para>
</refsect1>