How to Check PostgreSQL version: Server and Client

You can check the current PostgreSQL version in several ways depending on whether you’re inside psql, using command line, or checking from SQL.

From SQL (psql shell or any client):

SELECT version();

This gives the full version details (including build info, compiler, and OS).

If you just want the number:

SHOW server_version;

Client version from Command Line:

psql --version
psql -V

From System Package Manager

RHEL/CentOS/Rocky/Alma:
rpm -qa | grep postgres
Debian/Ubuntu:
dpkg -l | grep postgre