How to find out PostgreSQL version: Simple and quick methods

  • Last updated: Nov 16, 2024
  • Views: 13
  • Author: Admin

PostgreSQL is one of the most popular and powerful database management systems. To successfully work with this DBMS, it is important to know its current version. The available functions, performance, and compatibility with various tools and libraries depend on the PostgreSQL version.

In this article, we will look at several simple ways to determine the version of the PostgreSQL DBMS.

The article on the page is based on my many years of experience with this technology and is presented to you as a short instruction, but if you want to get acquainted with it in more detail, then I recommend that you go to the official documentation on PostgreSQL.

 

The first option for checking what version of the PostgreSQL database you have installed is through the built-in psql utility that comes with the DBMS itself.

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

$. psql

postgresql check version

After successfully connecting to the database, we see a welcome window that immediately shows you which version of the database you have installed.

 

The second command to check this is to run the same command that is used to connect to the database through the psql utility, but only with the --version or -V parameter

$. psql --version

postgresql check version

Or

$. psql -V

postgresql check version

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


 

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

$. pg_config --version

postgresql check version


 

Well, and finally, a couple more options for viewing the version, this is when we have already connected to the database via the psql utility.

First request:

postgres# SELECT version();

postgresql check version

Second request:

postgres# SHOW server_version;

postgresql check version

As we can see, the first option contains a little more information about the version, and the second simply shows which version is installed.


 

Ultimately, knowing the PostgreSQL DBMS version is key to working effectively with this database. Regularly checking and updating the PostgreSQL version will allow you to take full advantage of this powerful DBMS and ensure stable operation of your applications.

 

SIMILAR ARTICLES