How to Check/Get PostgreSQL Version

New versions of PostgreSQL are released by the PostgreSQL Global Development Group on a regular basis. The major releases of Postgres are usually scheduled yearly and focus on improving key features as well as performance and security. In contrast, minor releases are scheduled nearly every three months. The minor releases focus on resolving evolving security issues and fixing bugs.

Try the new PgManage (Open Source) and get rid of PgAdmin!

If you intend to implement new software, you should check if it is compatible with your Postgres version, whether the latest security patch is available, etc. In such cases, knowing which Postgres version is active on your system might be useful.

Contact us today for all your Postgres and Open Source consulting and support needs.

Quick Outline

This blog post will teach you how to check the current version of Postgres running on your system using the following content.

So, let’s get started!

How to Check/Get Postgres Version on Windows?

To check the Postgres version on the Windows operating system different methods like CMD (Command Prompt), psql (SQL Shell), and pgAdmin are used. All these methods will be discussed in this section using appropriate screenshots:

Method 1: How to Check PostgreSQL Version Using the Command Prompt

Follow the below-given stepwise guidelines to check the currently installed PostgreSQL version on your system via the command prompt.

Step1: Access Bin Directory

Firstly, open the command prompt and run the following command to navigate to the Postgres bin folder:

cd C:\Program Files\PostgreSQL\14\bin
img

Hit the “Enter” button to access the desired directory/path:

img

The above snippet indicates the successful entry into the “bin” directory.

Step2: Check Postgres Version

Now execute the “psql -v” command to check the Postgres version:

psql -V
img

Alternatively, you can execute the “psql –version” command to find the Postgres version:

psql –version
img

The output shows that the “Postgres 14.4” version is running on your computer.

Method 2: How to Check the PostgreSQL Version Using SQL Shell

SQL Shell is a default Postgres terminal that helps us execute different SQL commands and meta-commands. Different commands like “SELECT VERSION()”, and “SHOW_VERSION” can be executed from SQL Shell to Check the Postgres version.

Launch the SQL Shell, fill in the login details, and run the below command to check which version of PostgreSQL is running on your machine:

SELECT VERSION();
img

Alternatively, you can utilize the following command to check the server version:

SHOW SERVER_VERSION;
img

The output proves that the specified command returns the PostgreSQL version.

Method 3: How to Check PostgreSQL Version Using pgAdmin

pgAdmin is a feature-rich GUI-based tool that is an open-source and freely available management tool for Postgres. Using pgAdmin, you can find the current Postgres version either manually or by executing SQL queries.

To check the PostgreSQL version via pgAdmin, users can follow the below-mentioned steps:

Step 1: Expand “Servers” Tree

Open the pgAdmin, specify the superuser password, and left-click on the “Servers” tree to expand it:

img

Step 2: Select Properties

Left-click on the “PostgreSQL” located under the “Servers” tree, and then click on the “Properties” tab:

img

Under the properties tab, you can check the currently installed PostgreSQL version on your system.

Note: You can also execute the “SELECT VERSION();” and “SHOW SERVER_VERSION;” commands in the pgAdmin’s query tool.

How to Check/Get Postgres Version on macOS?

Mac users can find the Postgres version either by using a terminal or pgAdmin. To find the Postgres version via pgAdmin, perform the same steps as we did for Windows. While to check the PostgreSQL version via the Mac Terminal, execute the command:

postgres -V

img

How to Check/Get Postgres Version on Linux?

To find the Postgres version on Linux, the “SQL Shell”, “pg_config” utility, the “dpkg” command, and the “apt-cache” command are used. All these methods are discussed with practical illustration in our dedicated guide on “Check Postgres Version on Linux”.

Final Thoughts

PostgreSQL is among the top databases that keep its users up-to-date by releasing new versions regularly. Postgres users can upgrade the currently used version to the latest one to avail the latest features. But before that, it’s recommended to check which Postgres version you are currently using.

To do that on the Windows system, users can run the “psql --version” command from the Command Prompt, the “SELECT VERSION()” command from SQL Shell, or use pgAdmin’s properties tab. Linux users can use the “SQL Shell”, “pg_config” utility, the “dpkg” command, or the “apt-cache” command to check the currently installed Postgres version. This blog post explained various approaches for checking the PostgreSQL version on Windows, MacOS, and Linux via practical demonstration.