How to Check the PostgreSQL Version

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

Use one of the following methods to check the PostgreSQL version via the command line.

  1. 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.
  2. The above output displays, that you are running version 13.3 of PostgreSQL server.

  3. 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 scritps.

    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)
  4. 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)

Conclusion

In this tutorial, you have learned 3 methods to check the PostgreSQL version.

The post How to Check the PostgreSQL Version appeared first on TecAdmin.

database Databases postgres PostgreSQL psql TecAdmin version