A C-based open-source database management system, PostgreSQL, was developed in 1996 by the University of California, Berkeley. PostgreSQL keeps updating the database version at regular time intervals. Its primary edition is released once a year and focuses on fixing known bugs, adding new features, and improving them. It is essential to know the version of PostgreSQL installed on your system, both as a database administrator and system administrator. Its minor version comes at least every three months to address ongoing security concerns.
Major Version of PostgreSQL
Earlier, its major version was represented as a decimal number, e.g., 9.6 or 9.0. After PostgreSQL 10, the central part of the version increased by one number for major release versions, e.g., 10, 11, 12, etc.
Minor Version of PostgreSQL
The last part number of the version shows the minor release number. E.g., 10.4 or 10.6 are minor versions of PostgreSQL version 10. In the past, Version 13.3 of PostgreSQL has been available for installation. We will explore different methods to check PostgreSQL’s version in this tutorial.
How to Check PostgreSQL Version
You can check the PostgreSQL version in several ways. Here, we will understand all the methods and see how you can check the version of PostgreSQL in your system.
Check the PostgreSQL Version Using Command-Line
You can check the current PostgreSQL version running on your system with the help of the command line. You can do this by accessing the terminal and running the following command:
You can run any of the previous commands and check the PostgreSQL version. Both the commands will provide you with the same output.
You get an error of “Postgres: command not found” if the Postgres binary is not present in the path to the file system. Let us troubleshoot this problem by searching the PostgreSQL binary directory. Run the following command in a terminal window:
With this command, you can see the full path to the PostgreSQL binary folder in your terminal. Type the full path to find out what version of PostgreSQL you have:
Both these commands will provide you with the same output.
Check the PostgreSQL Version Using SQL Shell
You can retrieve the PostgreSQL version through the PostgreSQL prompt. PostgreSQL versions are displayed on the post-login screen after logging into the PostgreSQL server through the terminal.
The server should log into the SQL prompt and get its output by executing the SQL command.
You can check the PostgreSQL version by preset parameter. Automatic version checking is also possible using the following method:
Through version() Function
By executing version(), you can also determine the PostgreSQL version. You can also check the PostgreSQL version in the automation script.
Apart from being a PostgreSQL client, psql is also a terminal-based command-line utility. Psql gives users access to PostgreSQL databases. Version information for the psql client utility can be found using the following command:
The previous commands will provide you with the same output to use by anyone.
Postgres Version in pgAdmin4
The pgAdmin4 web interface is an excellent way to manage PostgreSQL servers. The web interface shows the Postgres version for the pgAdmin4 users. To find out the PostgreSQL version, follow these steps:
- Login to the pgAdmin4.
- Select your Postgres server by expanding servers in the left sidebar.
- Now, go to the properties tab.
- The last step is to check the PostgreSQL version under the general section.
In this tutorial, we’ve discussed several methods to check the PostgreSQL version and see how easy it is to check each version. We hope that through this article, you have understood all the methods, and you will have learned to check the version of PostgreSQL by each method. Check the other Linux Hint articles for more tips and tutorials.
About the author
<img alt="" data-lazy-src="https://secure.gravatar.com/avatar/a6dca3a5394c9d066a8078ddf9ede366?s=112&r=g" data-lazy- height="112" src="data:image/svg xml,” width=”112″>
A passionate Linux user for personal and professional reasons, always exploring what is new in the world of Linux and sharing with my readers.