On 2023-08-19 14:22:25 +1000, Justin Clift wrote: > On 2023-08-19 14:10, David G. Johnston wrote: > > On Fri, Aug 18, 2023 at 6:36 PM Justin Clift <[email protected]> > > wrote: > > > > > If the minor version is already tracked somewhere as well, that > > > would be extremely useful for my use case. > > > > > > > > The data directory doesn't have a concept of "minor version". Only the > > installed libraries and binaries do. > > Thanks, that's what I figured. I'll have to keep state in a > PG_VERSION_MINOR > there or something. :)
Wouldn't it be better to ask whatever system you use to install the
software for the version?
E.g. on Debian derived Linuux distributions:
% dpkg -l postgresql-14
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name Version Architecture Description
+++-==============-=====================-============-=========================================================
ii postgresql-14 14.9-0ubuntu0.22.04.1 amd64 The World's Most Advanced
Open Source Relational Database
or
% apt policy postgresql-14
postgresql-14:
Installed: 14.9-0ubuntu0.22.04.1
Candidate: 14.9-0ubuntu0.22.04.1
Version table:
*** 14.9-0ubuntu0.22.04.1 500
500 http://security.ubuntu.com/ubuntu jammy-security/main amd64 Packages
500 http://archive.ubuntu.com/ubuntu jammy-updates/main amd64 Packages
100 /var/lib/dpkg/status
14.2-1ubuntu1 500
500 http://archive.ubuntu.com/ubuntu jammy/main amd64 Packages
If you compile the software yourself, you could always ask postgres:
% /usr/lib/postgresql/14/bin/postgres --version
postgres (PostgreSQL) 14.9 (Ubuntu 14.9-0ubuntu0.22.04.1)
hp
--
_ | Peter J. Holzer | Story must make more sense than reality.
|_|_) | |
| | | [email protected] | -- Charles Stross, "Creative writing
__/ | http://www.hjp.at/ | challenge!"
signature.asc
Description: PGP signature
