pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Laurenz Albe <laurenz.albe@cybertec.at>
To: J T <jorge.torralba@gmail.com>
To: Ron Johnson <ronljohnsonjr@gmail.com>
Cc: Pgsql-admin <pgsql-admin@lists.postgresql.org>
Subject: Re: Get PG primary version without substring manipulation?
Date: Fri, 14 Jun 2024 09:25:12 +0200
Message-ID: <efce406f2d4d3e394ca99fc0cccd8e3bf7a701f7.camel@cybertec.at> (raw)
In-Reply-To: <CACut7uQP7VVOcfqQ92QnE+UsraM_8eM0=s1UyDFyhb_g0jYvaw@mail.gmail.com>
References: <CANzqJaCSdXU3a4PZzG5cmR9t0qvpL2Wf+EAYL2b1kUO_GXMjtw@mail.gmail.com>
	<CACut7uQP7VVOcfqQ92QnE+UsraM_8eM0=s1UyDFyhb_g0jYvaw@mail.gmail.com>


On Thu, Jun 13, 2024 at 5:52 AM Ron Johnson <ronljohnsonjr@gmail.com> wrote:
> cut, awk, head, bash, etc are easy enough,  but am I overlooking some intrinsic
> method of getting just PG's primary version number (9.6 or 14, in my case) without
> doing substring manipulation?

I like

  psql -Atq -c "SELECT current_setting('server_version_num')::integer / 10000"

Yours,
Laurenz Albe





view thread (6+ messages)

Message-ID: <efce406f2d4d3e394ca99fc0cccd8e3bf7a701f7.camel@cybertec.at>
Permalink:  ../efce406f2d4d3e394ca99fc0cccd8e3bf7a701f7.camel@cybertec.at/
Also on:    postgresql.org/message-id/efce406f2d4d3e394ca99fc0cccd8e3bf7a701f7.camel@cybertec.at

 · 

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: laurenz.albe@cybertec.at, jorge.torralba@gmail.com, ronljohnsonjr@gmail.com, pgsql-admin@lists.postgresql.org
  Subject: Re: Get PG primary version without substring manipulation?
  In-Reply-To: <efce406f2d4d3e394ca99fc0cccd8e3bf7a701f7.camel@cybertec.at>

* 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