Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1wgU3c-006DPn-1i for pgsql-general@arkaria.postgresql.org; Sun, 05 Jul 2026 21:07:20 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wgU3b-00Di2D-0p for pgsql-general@arkaria.postgresql.org; Sun, 05 Jul 2026 21:07:19 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1wgU3a-00Di24-26 for pgsql-general@lists.postgresql.org; Sun, 05 Jul 2026 21:07:18 +0000 Received: from mail-yx1-xb12f.google.com ([2607:f8b0:4864:20::b12f]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1wgU3T-00000001hGF-0fFi for pgsql-general@lists.postgresql.org; Sun, 05 Jul 2026 21:07:12 +0000 Received: by mail-yx1-xb12f.google.com with SMTP id 956f58d0204a3-664c4a04081so1857378d50.2 for ; Sun, 05 Jul 2026 14:07:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1783285630; cv=none; d=google.com; s=arc-20260327; b=lU8eIBLfX9jRPaDP/T7RisknLLgukATQsOPemOjojXJj3lLiDeGbpj0FodXAKrF9lF nD0Tf7v7moS1oANYbMmu5kGtuxT6KngFPPPRKnboRm1NgZZe8/pxlJ1ivV01wWa46V2n 95bdA8LOGBjX95izoiewo+HaF7nMjME0LO3uBhX6IS9QoK+OFefMY68S1LAN3BEJZ7MJ UDndXHPtnuvQVWAIB4wX2PwX9TYBpd05c4p1FWcgYVS6K0Uj/80wt37K7qQUpfKHvx/V GI0By9KD5JmTJLYf0GD0NjhHyx6V1dDNtR1HQzItkGu7Q4fI4chT4QBFrqt/+ZeIMhXa 2uxw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20260327; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=eT3n9X/rXiBRAlEJvh79yysxQR/f6qQZNfqt/FRunWE=; fh=vEpCbXGGMFR6Q1XdvU0l/OOS90i44kusFzu9ldIwKlI=; b=VG1nTxsElkgGZ6RpvCxC//u9y9oJrSlU2mpbxLzgOtklDXxwvAix36gkDZ8jwLVF1C 75wezhXpNR9FBb+h5qZIOqe2yYmjoAyRImVG4PZYP6ZWukdveotzGf/knFu/gvyQb76p VGav3K9j8Wd4/Qtvr06th3hm7d24ZrQqnyGp/VUmDTZCcLWYySWKl0R4WXgcWcRMbHtD fbYhDkqUgPHLxl4iur1TzbwGERHRFTlwT/0/z8vrm3fPueAa0PqdGpqO0LyNW9HwmGSs EDtQj1Rd3gNPzztOM5v3QXsFHbSI/PmFRKDddvmVPSdOSKVvB9ltQgpfOV2ZyVYkYIIA ctmQ==; darn=lists.postgresql.org ARC-Authentication-Results: i=1; mx.google.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1783285630; x=1783890430; darn=lists.postgresql.org; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :from:to:cc:subject:date:message-id:reply-to; bh=eT3n9X/rXiBRAlEJvh79yysxQR/f6qQZNfqt/FRunWE=; b=R7gXYXKU4YNrA8pobEcLVHB7alT5gdap8+hoWgNVvzLkayLv0uCYqvtq4TEz4V2m3C kX6ylS5hfTRBwVe0FdTpJ+kDnqH+lli82318ngC97pTPJ/L/qZsFrTICUDVd4aBqk61C LkYGF2reUk0y57W94MCy2OZTC+RVMjt08fCzeb/v0H3NDKO4kz0a+W5tDqS9+bEIzFFb A97XLcXd58G0W+0pJMfVrA1Vaz7N3wDpWrOjv8/mDHBv4/UFjzGcz+L6M60sEKjkjnRm VrTjwZWKVZ585N2ns+pZs13GL1fABH/i5iJHim2tV2VmWLri9cUPCJ807eQqi8643fFn +dsw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1783285630; x=1783890430; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=eT3n9X/rXiBRAlEJvh79yysxQR/f6qQZNfqt/FRunWE=; b=hZNXnTXfcRhl6WaFEiAKlJ5U6knXE0bPHCWJIpnBZs902Xnjjror7rLE0lUK/cbyoh Kbm29gq4U773vYyQintgWlqWVAsyyQ/nyPU3vHLkTl1HV4nSWNJNCsIY5OQ83MdqIZUr 7Zb303RjVy1Zu0yeDom4OzGgo/9R8lxIJm1lNtCLRmd1MUyVzcXKR1dyzeXHKyYEwJRo qx/Qca4HDSs/D2Gh3ndQphaYmR4vsKgNN0+TDc3DGkPMlOk7FBlGXvyaNO+OzOy4WQNM pjpHNTD5hFomAKEkqrF0NTaOmClU40VdmYCOIPGOX0p9RIvCiqdgfNmzTjvgsmE/lZCD 337g== X-Forwarded-Encrypted: i=1; AHgh+RqaFiSHEz5wFoPRfuLF5sjKyPfpYbrzNLvVhIKqskdJ+5vN6BcOMmNiFgvEHVzrsyh0tpXpxgv5u/jNHtEw@lists.postgresql.org X-Gm-Message-State: AOJu0YycstvnaFH971QvOWy50IXuEoBYle7zINKezi+nOVBEMR4CIhCy cYivb5gI7LW2JfDlBfMs6RW/Y173McSc7E8+lCNO1FZ4zwiX+goE5inap2fS6vCVy8/Xk8Yk4EP M0VJ7kj67Db/OATuRlqV/5aLGaNXuBrk= X-Gm-Gg: AfdE7cniuqxx8ON/aIGpy0L2BDSu4RCy1RjzRoqA0/DQSEaH73IPpzYhcHmtlHMCJmk DZ7L/4viHpZYTNJepSqD6BOK8Be+SizRmgB+2b69ttrvaizsyYoabDGhJpeb5J+bX1RZtvxoWdx fLayJXjDMNSU5FffNd5QKOCaq5U5ESngfpcycpP2NeGmanF2be3dKejmV2l8d9cn+6qr6VHF/hd hcxBqk1AWYf48dSsRm1rtCRGTyn6oN6WFVcmB4zf3idKe3sVW5dyVDxKj0kxG69mDhPDyC5PHIN YvzQR5s5MnKzTqSD22LZOX4v0/RnOoUvCIhq4ytfN3XQoGCZ3W6VPw== X-Received: by 2002:a05:690c:7409:b0:812:99ef:5136 with SMTP id 00721157ae682-81739ee263dmr87752337b3.50.1783285630256; Sun, 05 Jul 2026 14:07:10 -0700 (PDT) MIME-Version: 1.0 References: <31f963d5-4395-4215-96ab-92448283147a@aklaver.com> In-Reply-To: From: Igor Korot Date: Sun, 5 Jul 2026 16:06:56 -0500 X-Gm-Features: AVVi8Cf1gvicZ39gIAQ0a_X5SVrlGoXQGrqeec3UXfIMdEOw7bSqTXCvXnUu81Y Message-ID: Subject: Re: Get version info To: Brent Wood , "pgsql-generallists.postgresql.org" Content-Type: multipart/alternative; boundary="0000000000008648300655e38a6f" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --0000000000008648300655e38a6f Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi, Brent, On Sun, Jul 5, 2026 at 3:20=E2=80=AFPM Brent Wood wrote: > I might be missing something, but... > > You are asking for a shell command - surely > Please read the subject line of this thread. And so in order to test it I can run the command inside the Terminal/shell... Thank you. > > *psql -d ... -c "select version();"* > > Is a shell command? > > But for a non-psql option: > > Note that version() is built into the postgres binary itself, if you put > the postgres bin folder in your system or user path you can simply run: > *postgres -V* > *postgres (PostgreSQL) 16.14 (Ubuntu 16.14-0ubuntu0.24.04.1)* > > If it is not in your path, you need to use the full path: > */usr/lib/postgresql/16/bin/postgres -V* > *postgres (PostgreSQL) 16.14 (Ubuntu 16.14-0ubuntu0.24.04.1)* > > Easy to wrap in a script (given you want a shell command I figure you wan= t > a Linux solution): > > #! /bin/bash > # return Postgres version from the command line > *CMD=3D`locate postgresql | grep bin | grep postgres$`* > *$CMD -V | cut -f 3 -d " "* > > Eg: with this text in a file called get_ver > > *bash get_ver * > *16.14* > > You can simplify it slightly, but make the script a bit more arcane: > > *#! /bin/bash* > *# return Postgres version from the command line* > > *`locate postgresql | grep bin | grep postgres$` -V | cut -f 3 -d " "* > > > Hope this helps... > > > Brent Wood > ------------------------------ > *From:* Igor Korot > *Sent:* Monday, 6 July 2026 6:14 am > *To:* Adrian Klaver ; > pgsql-generallists.postgresql.org > *Subject:* Re: Get version info > > Hi, Adrian, > > On Sun, Jul 5, 2026 at 9:53=E2=80=AFAM Adrian Klaver > wrote: > > > > On 7/5/26 1:18 AM, rob stone wrote: > > > On Sun, 2026-07-05 at 01:32 -0500, Igor Korot wrote: > > >> Hi, ALL, > > >> Google recommends using pg-config. > > >> > > >> However, some distro prefer to use pkg-config and don't even include > > >> local configuration file. > > >> > > >> Is this file located everywhere and if not - how do I check it insid= e > > >> configure.ac? > > >> > > >> Thank you. > > >> > > > > > > > > > See chapter 9.27.11, not Mr. Google. > > > > > > select version(); > > > > > > PostgreSQL 18.4 (Debian 18.4-1+b1) on x86_64-pc-linux-gnu, compiled b= y > > > x86_64-linux-gnu-gcc (Debian 15.3.0-1) 15.3.0, 64-bit > > > (1 row) > > > > In addition: > > > > show server_version; > > server_version > > ------------------------------------ > > 17.10 (Ubuntu 17.10-1.pgdg24.04+1) > > > > > > show server_version_num; > > server_version_num > > -------------------- > > 170010 > > Again this is inside psql not inside shell/configure.ac > > Thank you. > > > > > -- > > Adrian Klaver > > adrian.klaver@aklaver.com > > > > *Brent Wood * > Principal Technician - GIS and Spatial Data Management > +64-4-386-0529 > 301 Evans Bay Parade, Greta Point, Hataitai, Wellington, New Zealand > Earth Sciences New Zealand > [image: Earth Sciences New Zealand] > The Institute of Geological and Nuclear Sciences Limited and the National > Institute of Water and Atmospheric Research Limited joined to become the > New Zealand Institute for Earth Science Limited. We are known as Earth > Sciences New Zealand. For more information on the Earth Sciences transiti= on click > here . > > *Notice:* This email and any attachments may contain information which is > confidential and/or subject to copyright or legal privilege, and may not = be > used, published or redistributed without the prior written consent of Ear= th > Sciences New Zealand. If you are not the intended recipient, please > immediately notify the sender and delete the email and any attachments. A= ny > opinion or views expressed in this email are those of the individual send= er > and may not represent those of Earth Sciences New Zealand. > > For information about how we process data and monitor communications > please see our privacy policy . > --0000000000008648300655e38a6f Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi, Brent,

On Sun, Jul 5, 20= 26 at 3:20=E2=80=AFPM Brent Wood=C2=A0
I might be missing something, but...

You are asking for a shell command - surely
<= div>
Please read the subject line of this thread.
<= br>
And so in order to test it I can run the command inside the T= erminal/shell...

Thank you.
=C2=A0

psql -d=C2=A0 ... -c "select version();"=C2=A0=C2=A0

Is a shell command?

But for a non-psql option:

Note that version() is built into the postgres binary itself, if you put th= e postgres bin folder in your system or user path you can simply run:
postgres -V
postgres (PostgreSQL) 16.14 (Ubuntu 16.14-0ubuntu0.24.04.1)

If it is not in your path, you need to use the full path:
/usr/lib/postgresql/16/bin/postgres -V
postgres (PostgreSQL) 16.14 (Ubuntu 16.14-0ubuntu0.24.04.1)

Easy to wrap in a script (given you want a shell command I figure you want = a Linux solution):

#! /bin/bash
# return Postgres version from the command line
CMD=3D`locate postgresql | grep bin | grep postgres$`
$CMD -V | cut -f 3 -d " "

Eg: with this text in a file called get_ver

bash get_ver=C2=A0
16.14

You can simplify it slightly, but make the script a bit more arcane:

#! /bin/bash
# return Postgres version from the command line

`locate postgresql | grep bin | grep postgres$` -V | cut -f 3 -d " = "


Hope this helps...


Brent Wood

From:=C2=A0Igor Korot <ikorot01@gmail.com>
Sent:=C2=A0Monday, 6 July 2026 6:14 am
To:=C2=A0Adrian Klaver <adrian.klaver@aklaver.com>; pgsql-generallists.pos= tgresql.org <pgsql-general@lists.postgresql.org>
Subject:=C2=A0Re: Get version info
=C2=A0
Hi, Adrian,

On Sun, Jul 5, 2026 at 9:53=E2=80=AFAM Adrian Klaver <adrian.klaver@aklaver.com&= gt; wrote:
>
> On 7/5/26 1:18 AM, rob stone wrote:
> > On Sun, 2026-07-05 at 01:32 -0500, Igor Korot wrote:
> >> Hi, ALL,
> >> Google recommends using pg-config.
> >>
> >> However, some distro prefer to use pkg-config and don't e= ven include
> >> local configuration file.
> >>
> >> Is this file located everywhere and if not - how do I check i= t inside
> >> configure.a= c?
> >>
> >> Thank you.
> >>
> >
> >
> > See chapter 9.27.11, not Mr. Google.
> >
> > select version();
> >
> > PostgreSQL 18.4 (Debian 18.4-1+b1) on x86_64-pc-linux-gnu, compil= ed by
> > x86_64-linux-gnu-gcc (Debian 15.3.0-1) 15.3.0, 64-bit
> > (1 row)
>
> In addition:
>
> show server_version;
>=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0 server_version
> ------------------------------------
>=C2=A0=C2=A0 17.10 (Ubuntu 17.10-1.pgdg24.04+1)
>
>
> show server_version_num;
>=C2=A0=C2=A0 server_version_num
> --------------------
>=C2=A0=C2=A0 170010

Again this is inside psql not inside shell/configure.ac

Thank you.

>
> --
> Adrian Klaver
> adrian.= klaver@aklaver.com



Brent Wood
Principal Technician - GIS and Spatial= Data Management
+64-4-386-= 0529
301 Evans Bay Parade, Greta Point, Hataitai, Wellington, New Zealand
Earth Sciences New Zealand
The Institute of Geological and Nuclear Sciences Limited and the National I= nstitute of Water and Atmospheric Research Limited joined to become the New= Zealand Institute for Earth Science Limited. We are known as Earth Science= s New Zealand. For more information on the Earth Sciences transition click here.

Notice: This email and any attachments may contain information which= is confidential and/or subject to copyright or legal privilege, and may no= t be used, published or redistributed without the prior written consent of = Earth Sciences New Zealand. If you are not the intended recipient, please immediately notify the sender and d= elete the email and any attachments. Any opinion or views expressed in this= email are those of the individual sender and may not represent those of Ea= rth Sciences New Zealand.

For information about how we process data and monitor communications please= see our priva= cy policy.
--0000000000008648300655e38a6f--