Re: client/server versions - Mailing list pgsql-general

From Adrian Klaver
Subject Re: client/server versions
Date
Msg-id 93770442-ad9a-4fb5-9baa-0005b305e8c7@aklaver.com
Whole thread Raw
In response to client/server versions  (Dick Visser <dnmvisser@gmail.com>)
List pgsql-general
On 11/21/23 03:28, Dick Visser wrote:
> Hi
> 
> I'm working with AWS RDS PG instances that have been created over time, 
> and that by now are a mix of several major/minor versions ranging from 
> 12 to 15.
> The initial configuration and management is done from an EC2 instance 
> running Debian 11, which has Postrgres 13.13.
> I already found out that there are compatibility issues if I use the 
> client programs from the Debian VM when they're older than the server 
> version.
> To avoid this I tried to run the client programs from a dedicated PG 
> container image with the same version as the server.
> So instead of running:
> 
> PGSERVICE=foobar psql
> 
> I would now run:
> 
> podman run -e PGSERVICE=foobar -v 
> $(pwd)/.pg_service.conf:/root/.pg_service.conf --rm -it 
> docker.io/library/postgres:15.3 <http://docker.io/library/postgres:15.3> 
> psql
> 
> This is reasonably straightforward and seems to just work.
> Now that I have a way to pick whatever client version I need, I wonder 
> what the best strategy is wrt versions...
> Keeping them exactly the same, or is it better to always use the latest 
> client version?

Not sure how you installed the Postgres versions and what the OS'es are 
for all the instances? If you used the Debian/Ubuntu repos or Postgres 
community repo Debian/Ubuntu packages then you got the program 
pg_wrapper installed.

Per man pg_wrapper or postgresql-common(they point to the same thing) file:

"""
  This program is run only as a link to names which correspond to 
PostgreSQL programs in /usr/lib/postgresql/version/bin. It determines 
the configured cluster and database for the user and calls the 
appropriate version of the desired program to connect to that cluster 
and database, supplying any specified options to thatcommand.

...


For psql, pg_archivecleanup, and pg_isready, pg_wrapper will always use 
the binary from the newest PostgreSQL version installed, as these are 
downwards compatible.
"""

> I know that the latter is a bit easier as one can just pick an untagged 
> container image, because that corresponds to the latest version.
> Also I'm thinking that using the latest version of pg_dump/pg_restore 
> allows you to have more options.
> 
> thx
> 
> Dick Visser
> 

-- 
Adrian Klaver
adrian.klaver@aklaver.com




pgsql-general by date:

Previous
From: Dick Visser
Date:
Subject: Re: client/server versions
Next
From: Joan Pujol
Date:
Subject: Retrieve results in PostgreSQL stored procedure allowing query parallelism