How to Check the PostgreSQL Version

Checking your PostgreSQL database version is a simple process, but there are several ways to obtain that information. If you are connected to your database you can simply run the following command.

SELECT version();

|                                                                version                                                                |
| PostgreSQL 9.5.17 on x86_64-pc-linux-gnu (Ubuntu 9.5.17-1.pgdg14.04+1), compiled by gcc (Ubuntu 4.8.4-2ubuntu1~14.04.4) 4.8.4, 64-bit |

In this case, 9.5.17 is the version number. Another option is the SHOW command.

 SHOW server_version;

| server_version |
| 9.5.17         |

You can also obtain the Postgres version at the command line.

psql --version
psql (PostgreSQL) 11.5

If the PostgreSQL binary is not in system’s PATH, you’ll get an error saying “postgres: command not found”. This may occur when the PostgreSQL package is not installed from the distribution’s standard repositories. You can find the path to the binary either with the locate or find commands.

PostgreSQL Versioning

PostgreSQL releases are versioned using a MAJOR.MINOR scheme. For example, in PostgreSQL 11.1, 11 is a major version, and 1 is a minor version. PostgreSQL major releases are generally delivered once a year. Each major release is supported for 5 years.

Starting with PostgreSQL 10, each new major release increases the MAJOR part of the version by one, e.g., 10, 11 or 12. Before PostgreSQL 10, major versions were represented with a decimal number e.g., 9.0 or 9.6.

Minor release number is the last part of the version number. For example, 11.4 and 11.6 are minor versions that are part of the PostgreSQL version 11, and 9.6.15 and 9.6.16 are part of the PostgreSQL version 9.6.

Matt McGuire

Proven technology leader with 25+ years of experience in the installation, administration, development, design, and maintenance of various enterprise data related systems.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.