How to Check the PostgreSQL Database Version

Postgres update database version at regular intervals. Major PostgreSQL version is released every year and minor versions are released at least once every three months.

Each major version focus on improving or adding new features and fixing known bugs if they appear during previous version and minor versions basically focus on any ongoing security concern.

Official Document on Versioning Policy.

https://www.postgresql.org/support/versioning/

Trending Article:

Check PostgreSQL Version using PSQL Command Line

bash-4.1$ psql
postgres=# SELECT version();
postgres=# SHOW server_version;
Checking PostgreSQL Version running on Linux and windows using command line.

As you can see above, Postgres 12.1 version is running on Linux RHEL 64 bit.

Checking PostgreSQL Version from Command Line

NOTE: set Postgres env or else check the path of postgres executable location inside bin directory as below.

bash-4.1$ locate bin/postgres
 /usr/lib/debug/usr/pgsql-12/bin/postgres.debug
 /usr/pgsql-12/bin/postgres

bash-4.1$ /usr/pgsql-12/bin/postgres --version
 postgres (PostgreSQL) 12.1

bash-4.1$ /usr/pgsql-12/bin/postgres -V
 postgres (PostgreSQL) 12.1
Check which Postgres Version you are using.

To Check Client Version.

You can use anyone of the below command to check PostgreSQL Client version.

bash-4.1$ psql --version
 psql (PostgreSQL) 12.1

 bash-4.1$ psql -V
 psql (PostgreSQL) 12.1