There are a few ways to find the PostgreSQL version.

  • Using the psql command-line tool:

Open a terminal window and type the following command:

psql -V

This will print the PostgreSQL version to the terminal window.

  • Using the SELECT VERSION() command:

Connect to a PostgreSQL database using the psql command-line tool. Once you are connected, type the following command:

SELECT VERSION();

This will return the PostgreSQL version as a string.

  • Using the PostgreSQL client:

If you are using a PostgreSQL client, such as pgAdmin, you can find the PostgreSQL version in the client’s properties window.

Here are some examples of how to find the PostgreSQL version using the different methods:

# Using the psql command-line tool
$ psql -V
PostgreSQL 12.4

# Using the `SELECT VERSION()` command
$ psql -d mydb -h localhost -p 5432
postgres=# SELECT VERSION();
version
-------
PostgreSQL 12.4

# Using the PostgreSQL client
(pgAdmin) Right-click on the PostgreSQL server and select Properties.
(pgAdmin) Click on the Server tab.
(pgAdmin) The PostgreSQL version is displayed in the Version field.