PostgreSQL is an advanced, open-source relational database management system. It is written in C programming language and was developed at the University of California, Berkeley in 1996. Initially, version 1.0 of Postgres95 was announced on September 5, 1995. The first non-university version of PostgreSQL was provided on July 8, 1996, by Marc Fournier at Hub.org Networking Services. Which is the first version of PostgreSQL for public use.
As of today, PostgreSQL 13.3 is the latest stable version available for installation. PostgreSQL version 9.5 and lower versions are no more supported by the team.
In this tutorial, you will learn, how to check the PostgreSQL version on your system.
How to Find PostgreSQL Version using Command line
Use one of the following methods to check the PostgreSQL version via the command line.
Check Version with Login
Once you login to the PostgreSQL server via terminal, The post login screen displays the PostgreSQL version you have connected to.
psql
Output:psql (13.3 (Ubuntu 13.3-1.pgdg20.04+1)) Type "help" for help.Check Version with version() Function
You can also execute version() function to find out the PostgreSQL version. This method can also help you to check PostgreSQL version in automation scripts.
SELECT version();
Output:version ------------------------------------------------------------------------------------ PostgreSQL 13.3 (Ubuntu 13.3-1.pgdg20.04+1) on x86_64-pc-linux-gnu, compiled by gcc (1 row)Check Version with Parameters
Alternatively, you can also find the PostgreSQL version by the preset parameters, and you can also use this method for automatic version checks.
SHOW server_version;
Output:server_version ---------------------------------- 13.3 (Ubuntu 13.3-1.pgdg20.04+1) (1 row)
The above output displays, that you are running version 13.3 of PostgreSQL server.
Check the below screenshot for all commands in action to check the Postgres version on command line.
How to Find Postgres Version in pgAdmin4
pgAdmin4 is an excellent web interface for managing the PostgreSQL servers. So the pgAdmin4 users can also find the Postgres version on the web interface.
To get the version, follow:
- Login to pgAdmin4
- In the left sidebar, expand the Servers and select your Postgres server
- Go to Properties tab
- Under the General section, check for PostgreSQL version.
Conclusion
In this tutorial, you have learned 3 methods to check the PostgreSQL version via the command line. Also provided the steps to find version in pgAdmin4.