79090357

Date: 2024-10-15 14:21:39
Score: 0.5
Natty:
Report link

WARNING: this is only checking if postgres CLIENT is installed (which can be installed WITHOUT installing the server)

psql --version; 

AI suggested this:

pg_isready 
/var/run/postgresql:5432 - accepting connections

possibly a ubuntu only way is to use absolute path to the binary:

/usr/lib/postgresql/14/bin/postgres --version
postgres (PostgreSQL) 14.13 (Ubuntu 14.13-1.pgdg22.04+1)

/usr/lib/postgresql/12/bin/postgres --version
postgres (PostgreSQL) 12.20 (Ubuntu 12.20-1.pgdg22.04+1)

but it is very bewildering that this is so tricky and that this use case was not documented by postgres developers?

during install a soft link should be put from under /usr/lib/postgresql/14/bin/postgres to /usr/bin

that points to the (lastest?) postgres binary installed, so a simple postgres --version would work and show if postgres SERVER is installed.

Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Contains question mark (0.5):
  • Low reputation (1):
Posted by: user418615