How to check PostgreSQL version - Linux

  • Last update: Apr 3, 2024
  • Views: 22
  • Author: Admin
How to check PostgreSQL version - Linux

Colleagues hello to all.

In today's article I will tell you how you can see what version of PostgreSQL DBMS you have installed.

The PostgreSQL developers release new versions at regular intervals. With the release of a new version of the database, developers fix bugs and add new features. There are so-called major releases and  minor releases. PostgreSQL major releases typically come out about once a year, and minor releases every three months. Minor releases are usually focused on solving current security issues, while major releases are about adding new functionality.

How to download and install Postgresql 14 on Linux CentOS/RHEL 8/7 TAR

The first way to check what version of the PostgreSQL database you have is through the built-in psql utility that comes with the DBMS itself, through this utility you just connect to the database.

The first command is when we simply connect to the database through the psql utility.

$. psql

postgresql check version

After a successful connection to the database, we will see a welcome window in which it immediately shows you what version of the database you have installed.

 

The second command to check is to run the same command that connects to the database via the psql utility, but with the --version or -V parameter

$. psql --version

postgresql check version

or

$. psql -V

postgresql check version

Using these two command options, it will show you what version of the Postgresql database you have installed without actually connecting to the console, as it was in the example above.


 

In the following example, we will use the pg_config utility to view the Postgresql database version. This utility is designed to display information about the database configuration parameters, and it can also show the version of your database.

$. pg_config --version

postgresql check version


 

And finally, a couple more options for viewing the version, this is already when we connected to the database through the psql utility.

First request:

postgres# SELECT version();

postgresql check version 

Second request:

postgres# SHOW server_version;

postgresql check version

As you can see, in the first version there is a little more information about the version, and in the second it is purely to show which version is installed.


 

The commands and SQL statements shown are the most efficient ways to determine the PostgreSQL DBMS version. Enjoy!

Thank you all, I hope that my article helped you in some way.

 

SIMILAR ARTICLES