Which version of PostgreSQL am I running?

You just got hired, asked to perform a health check on PostgreSQL servers and you don’t know exact version of PostgreSQL.

TL;DR: SELECT VERSION(); or pg_config –version

When we say version, there are two possibilities, client version and server version.

Checking Client Version

psql is our client on terminals, to check it’s version psql –version command:

postgres@bbe89c90b5eb:~$ psql --version
psql (PostgreSQL) 15.3 (Debian 15.3-1.pgdg110+1)

Checking Server Version

To check PostgreSQL server’s version you have two options.

Option 1

If you are connected server via shell, you can ask pg_config utility to display version:

postgres@bbe89c90b5eb:~$ pg_config --version
PostgreSQL 15.3 (Debian 15.3-1.pgdg110+1)

Option 2

If you are connected to psql or pgAdmin you can run following query to display version information:

postgres=# SELECT VERSION();
                                                           version

------------------------------------------------------------------------------------------------------------------------
-----
 PostgreSQL 15.3 (Debian 15.3-1.pgdg110+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 10.2.1-6) 10.2.1 20210110, 64
-bit
(1 row)

You can use either way to query server’s version.

Please do not hesitate to ask anything or anything to add, please leave a comment below.

A new post everyday, subscribe now and don’t miss it!

Subscribe to our newsletter for cool news

Hi! I’m an IT Specialist

I want to hear from you! I am Working with enterprises for 10+ years to improve their infrastructure and efficiency.

Get in touch with me.

Leave a Reply

Discover more from Empower. Innovate. Transform.

Subscribe now to keep reading and get access to the full archive.

Continue reading