Jannah Theme License is not validated, Go to the theme options page to validate the license, You need a single license for each domain name.
Web Hosting

PostgreSQL Version Checking: Tips for Better Management


PostgreSQL updates its software periodically. Every year, there will be a significant update that emphasizes enhancing key functionality and addressing identified bugs. The goal of minor releases, which get released around three months in a row, is to address existing security issues.

It can be a good idea to verify whether you have the most recent security patch installed or even if the latest software you intend to use is compatible with the PostgreSQL edition you are using.

With the use of a couple of quick commands, this article showcases how to check the PostgreSQL version.

Check the PostgreSQL Version from the Command Line

Check PostgreSQL Version from Command Line

For a quick way to determine your PostgreSQL versions, open your terminal then type the following command:

postgres --version

Your terminal window shows the version number. Utilizing the -V option is also a different method to determine the PostgreSQL version:

postgres -V

Each of the commands listed here functions with installations started from authorized repositories. For installations coming from outside sources, they could prove to be appropriate. On the contrary, you can get the error message “Command ‘postgres’ not found”.

What to do if “Command ‘postgres’ not found” Error

What to do if "Command 'postgres' not found" Error

Look for the PostgreSQL binary folder to resolve the “Command ‘postgres’ not found” problem. To identify the correct Postgres path, type the following command:

locate bin/postgres

Your terminal immediately shows the location of your binary folder.

For displaying the PostgreSQL server’s most recent version, provide the complete path as well as the -V option:

/usr/lib/postgresql/10/bin/postgres -V

A common MAJOR.MINOR semantics versioning approach gets employed by the PostgreSQL Development Group. In the present scenario, the first component (10) denotes the MAJOR release edition. Under that major version, the second portion (12) denotes the MINOR release numbers.

Remember that you should upgrade PostgreSQL to the most recent minor version that matches the major edition you have installed.

Check Postgres Version From SQL Shell

Check Postgres Version From SQL Shell

Additionally, the PostgreSQL prompt can get used to getting the version number straight away. Type this command to open the PostgreSQL shell prompt:

sudo -u postgres psql

To figure out the most recent version, enter this SQL statement in the prompt:

SELECT version();

The complete version of the PostgreSQL server alongside the system data gets included in the output.

Furthermore, PostgreSQL version can get told to display the server_version parameter’s value by using the following command:

SHOW server_version;

The value for server_version as of right now gets shown in the outcome.

The value for server_version as of right now gets shown in the outcome.

How to Check PSQL Client Version?

How to Check psql Client Version?

The PSQL program serves as PostgreSQL’s front-end terminal. This is utilized for running queries and displaying the returned results.

To check the latest version of the Postgresql client utilities you have, run the command below:

psql --version
psql --version

The instructions required for determining the PostgreSQL server version alongside the psql client version are identical, as you’ll discover. In this case, too, the -V option is effective:

psql -V

Within the terminal, the PSQL version appears.

This situation can also result in the “Command not found” error. If that was the case use the command below to find the right location for the psql tool:

locate bin/psql

The whole path to the PSQL tool is provided in the output.

To determine the present psql version, utilize the returned path with the -V option:

/usr/lib/postgresql/10/bin/psql -V

You can examine the most latest version of postgresql client on your machine in the output that gets produced.

Also Read: How to Check CPU Usage or Utilization in Linux/Ubuntu?


The most reliable method for checking the PostgreSQL version that you have is to use the available SQL queries and commands. Make use of these to determine the version of the PSQL client utility and PostgreSQL database server that you are using.

Maintain the most recent version of your systems, while making sure they are regularly updated.

Arpit Saini

He is the Director of Cloud Operations at Serverwala and also follows a passion to break complex tech topics into practical and easy-to-understand articles. He loves to write about Web Hosting, Software, Virtualization, Cloud Computing, and much more.

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *