pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Wasim Devale <wasimd60@gmail.com>
Cc: Pgsql-admin <pgsql-admin@lists.postgresql.org>
Cc: pgsql-admin@postgresql.org
Subject: Re: psql utility
Date: Sat, 06 Jul 2024 16:08:17 -0400
Message-ID: <563362.1720296497@sss.pgh.pa.us> (raw)
In-Reply-To: <CAB5fag69N9bP=pwKriwu6BNidV_KV+_bXk8zvS5U+AVTGRnuJQ@mail.gmail.com>
References: <CAB5fag69N9bP=pwKriwu6BNidV_KV+_bXk8zvS5U+AVTGRnuJQ@mail.gmail.com>

Wasim Devale <wasimd60@gmail.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





view thread (4+ messages)  latest in thread

Message-ID: <563362.1720296497@sss.pgh.pa.us>
Permalink:  ../563362.1720296497@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/563362.1720296497@sss.pgh.pa.us

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-admin@postgresql.org
  Cc: tgl@sss.pgh.pa.us, wasimd60@gmail.com, pgsql-admin@lists.postgresql.org
  Subject: Re: psql utility
  In-Reply-To: <563362.1720296497@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox