Howtodojo logo
  • Home 
  • About 
  • Certifications 
  • Sample Database 
  • Cheatsheet 
  • Glossary 
  • Blog 
  • Tags 
  1.   Blog
  1. Home
  2. Blog
  3. How To Check the PostgreSQL Version

How To Check the PostgreSQL Version

Share via
Howtodojo
Link copied to clipboard

In this tutorial we learn how to check the PostgreSQL version. We will check the version using shell command line and SQL Shell.

On this page
Introduction   PostgreSQL Versioning   Check PostgreSQL Version From Command Line   Check PostgreSQL Version From SQL  
How To Check the PostgreSQL Version

Introduction  

In this tutorial we learn how to check the PostgreSQL version installed on a system. There are multiple methods to check PostgreSQL version and we will learn each of the method.

PostgreSQL Versioning  

Starting from version 10. PostgreSQL using the following pattern for it’s versioning number

MAJOR.MINOR

For example 10.1, 11.2, 12.3, and 13.0.

Before version 10. The major version use two number separated by dot.

For example:

  • PostgreSQL version 9.5.10 the major version is 9.5 and minor 10.
  • PostgreSQL version 9.6.4 the major version is 9.6 and minor version 4.

Understanding this difference is important to know if you need to do upgrade or have to match application requirements with specific major version of PostgreSQL or minor version of PostgreSQL

Check PostgreSQL Version From Command Line  

The first method to check the PostgreSQL version is to use the command line. On the system running PostgreSQL we can use the command below:

postgres --version
```bash

Another method to check the version of PostgreSQL from the command line is using the command below:

```bash
postgres -V

Check PostgreSQL Version From SQL  

The second method that we can use to check the PostgreSQL version is from the SQL shell. First, we need to change the user to the postgres user.

Then we connect to the local PostgreSQL database using the psql command.

psql
```bash

After connected to PostgreSQL shell we can use one the following query:

```bash
SELECT version();

Another query that we can run on PostgreSQL shell to get the running version is using the following query

SHOW server_version;
```bash

## Video Tutorial {#h-video-tutorial}





















    
        
    







        
        

        
            
                
                
                
            
        

        
## Summary {#h-summary} In this tutorial we learn how to check the version of PostgreSQL on the running system using two different methods, the first one is using shell command line and the second method is using SQL shell.
 How To Install Redis CLI on Ubuntu
IUS Repository On CentOS 7 : How To Enable 
On this page:
Introduction   PostgreSQL Versioning   Check PostgreSQL Version From Command Line   Check PostgreSQL Version From SQL  
Follow me

We publish tutorials, tips and tricks about Linux, open source, cloud computing, and infrastructure

     
Copyright © 2012 - 2025 howtodojo.com. |
Howtodojo
Code copied to clipboard