Re: psql utility

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Wasim Devale <wasimd60(at)gmail(dot)com>
Cc: Pgsql-admin <pgsql-admin(at)lists(dot)postgresql(dot)org>, pgsql-admin(at)postgresql(dot)org
Subject: Re: psql utility
Date: 2024-07-06 20:08:17
Message-ID: 563362.1720296497@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

Wasim Devale <wasimd60(at)gmail(dot)com> writes:
> I want to ask if psql is compatible with any postgresql version?
> Backward compatibility won't work, I know, but can there be a confirmation
> of forward compatibility from anyone?

As far as basic functionality goes, you can mix-n-match psql and
server versions over a very wide range. psql's backslash commands
(in particular the \d family) may fail if the server is newer than
psql, if there are incompatible catalog changes psql isn't prepared
for. Tab completion might be hit-or-miss for the same reason.

As a perhaps extreme example, I tried psql 8.4 against a current
(18-to-be) server:

$ psql ...
psql (8.4.22, server 18devel)
WARNING: psql version 8.4, server version 0.0.
Some psql features might not work.
Type "help" for help.
regression=# select * from int8_tbl ; -- tab completion worked here
q1 | q2
------------------+-------------------
123 | 456
123 | 4567890123456789
4567890123456789 | 123
4567890123456789 | 4567890123456789
4567890123456789 | -4567890123456789
(5 rows)
regression=# \d int8_tbl
ERROR: column "reltriggers" does not exist
LINE 1: ...ECT relchecks, relkind, relhasindex, relhasrules, reltrigger...
^
HINT: Perhaps you meant to reference the column "pg_class.relhastriggers".

> It works but any links or documentation or if anyone faced any issues
> please let me know.

The Notes section of the psql man page says

psql 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 psql itself. However, backslash
commands of the \d family should work with servers of versions
back to 9.2, though not necessarily with servers newer than psql
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.

(9.2 is the current support cutoff for backslash command testing;
that horizon moves from time to time.)

regards, tom lane

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Ron Johnson 2024-07-06 20:13:47 Re: psql utility
Previous Message Wasim Devale 2024-07-06 19:44:32 psql utility