Thread: psql utility

psql utility

From
Wasim Devale
Date:
Hi All 

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?

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

Thanks,
Wasim

Re: psql utility

From
Tom Lane
Date:
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



Re: psql utility

From
Ron Johnson
Date:
On Sat, Jul 6, 2024 at 3:44 PM Wasim Devale <wasimd60@gmail.com> wrote:
Hi All 

I want to ask if psql is compatible with any postgresql version?

Backward compatibility won't work, I know,

Or do you?

psql 16 is most certainly backwards compatible with PG server 9.6, for example.
 
but can there be a confirmation of forward compatibility from anyone?

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

Thanks,
Wasim

Re: psql utility

From
Muhammad Ikram
Date:
Hi Wasim, 

As pointed out by Tom, catalog changes are likely to break or show unexpected results. We often experienced this kind of issues in our regression runs for a tool where we used to migrate from other databases to different versions if Postgres Servers and then print using \… commands. Even if these worked, we had to make adjustments.

Regards

Muhammad Ikram,
Bitnine Global



On Sun, 7 Jul 2024 at 01:14, Ron Johnson <ronljohnsonjr@gmail.com> wrote:
On Sat, Jul 6, 2024 at 3:44 PM Wasim Devale <wasimd60@gmail.com> wrote:
Hi All 

I want to ask if psql is compatible with any postgresql version?

Backward compatibility won't work, I know,

Or do you?

psql 16 is most certainly backwards compatible with PG server 9.6, for example.
 
but can there be a confirmation of forward compatibility from anyone?

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

Thanks,
Wasim