psql: Reduce compatibility warning

Only warn when connecting to a newer server, since connecting to older
servers works pretty well nowadays.  Also update the documentation a
little about current psql/server compatibility expectations.
This commit is contained in:
Peter Eisentraut 2012-08-31 23:28:14 -04:00
parent ef58b87df2
commit 5cad024524
2 changed files with 20 additions and 10 deletions

View File

@ -3505,14 +3505,24 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
</listitem> </listitem>
<listitem> <listitem>
<para><application>psql</application> is only guaranteed to work smoothly <para><application>psql</application> works best with servers of the same
with servers of the same version. That does not mean other combinations or an older major version. Backslash commands are particularly likely
will fail outright, but subtle and not-so-subtle problems might come to fail if the server is of a newer version than <application>psql</>
up. Backslash commands are particularly likely to fail if the itself. However, backslash commands of the <literal>\d</> family should
server is of a newer version than <application>psql</> itself. However, work with servers of versions back to 7.4, though not necessarily with
backslash commands of the <literal>\d</> family should work with servers newer than <application>psql</> itself. The general
servers of versions back to 7.4, though not necessarily with servers functionality of running SQL commands and displaying query results
newer than <application>psql</> itself. 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 a copy of <application>psql</application> from each major
version around and be sure to use the version that matches the
respective server. But in practice, this additional complication should
not be necessary.
</para> </para>
</listitem> </listitem>

View File

@ -1694,8 +1694,8 @@ connection_warnings(bool in_startup)
else if (in_startup) else if (in_startup)
printf("%s (%s)\n", pset.progname, PG_VERSION); printf("%s (%s)\n", pset.progname, PG_VERSION);
if (pset.sversion / 100 != client_ver / 100) if (pset.sversion / 100 > client_ver / 100)
printf(_("WARNING: %s version %d.%d, server version %d.%d.\n" printf(_("WARNING: %s major version %d.%d, server major version %d.%d.\n"
" Some psql features might not work.\n"), " Some psql features might not work.\n"),
pset.progname, client_ver / 10000, (client_ver / 100) % 100, pset.progname, client_ver / 10000, (client_ver / 100) % 100,
pset.sversion / 10000, (pset.sversion / 100) % 100); pset.sversion / 10000, (pset.sversion / 100) % 100);