banner



How To Check If Postgres Is Installed

Introduction

New versions of PostgreSQL are released at regular intervals. Major releases are scheduled yearly and focus on improving key features and fixing known bugs. Small-scale releases are available approximately every three months and aim to resolve ongoing security concerns.

You might want to cheque if you lot have the latest security patch, or if the new software you want to implement is compatible with your PostgreSQL version.

This tutorial shows you lot how to cheque your PostgreSQL version using a few short commands.

Title with PostgreSQL logo and versioning symbol.

Note: Have you lot considered installing SQL Workbench for Postgres? Information technology's a great tool for managing different database systems.

Prerequisites

  • Admission to a concluding window/command line
  • PostgreSQL database server

Check PostgreSQL Version from Command Line

Admission your concluding and enter the post-obit control to bank check your PostgreSQL version:

          postgres --version        

The version number is displayed in your terminal window. Another mode to cheque your PostgreSQL version is to apply the -Five option:

          postgres -V        

These 2 commands piece of work with installations initiated from official repositories. They might non exist applicative for installations originating from 3rd-party sources. Instead, you lot might receive the "Command 'postgres' not constitute" message.

How to Solve the "Command 'postgres' not found" Error

To solve the "Control 'postgres' non found" effect, locate the PostgreSQL binary folder. Enter the post-obit command to locate the right postgres path:

          locate bin/postgres        

The path to your binary binder is now displayed in your terminal.

Path to postgres binary folder with the locate command.

Type the full path and add the -V option to brandish the current PostgreSQL server version:

          /usr/lib/postgresql/10/bin/postgres -V        

In this example, the Postgres version number is ten.12.

The postgres version number is presented in the terminal.

The PostgreSQL Development Group uses a standard MAJOR.MINOR semantic versioning system. In our example, the first section (10) signifies the MAJOR release number. The second part (12), represents the MINOR release number for that major version.

Note: Always update PostgreSQL to the latest available minor version that corresponds to the major version yous accept installed.

Check Postgres Version from SQL Vanquish

The version number can too be retrieved direct from the PostgreSQL prompt. Access the PostgreSQL shell prompt by typing the post-obit command:

          sudo -u postgres psql        

Type the following SQL statement inside the prompt to check the current version:

          SELECT version();        

The resulting output provides the full version and system data for the PostgreSQL server.

The location of the PostgreSQL version found from the Postgres shell.

Yous tin also instruct PostgreSQL to bear witness the value associated with the server_version parameter:

          Testify server_version;        

The consequence displays the current value for server_version.

PostgreSQL version with the SHOW server_version statement.

How to Check psql Customer Version

Psql functions equally a front-end terminal for PostgreSQL. Information technology's used to upshot queries and display the provided results.

You can utilise the following control to determine the version of the psql client utility:

          psql --version        

You lot'll observe that the commands used to check the psql client version match the commands used to decide PostgreSQL server version. The -V option works in this instance as well:

          psql -V        

The psql version is presented in the terminal.

Pslq version displayed using the psql -V command.

The "Control not found" error tin announced in this case as well. If that is the instance, enter the post-obit command to locate the right path to the psql utility:

          locate bin/psql        

The output provides the full path to the psql utility.

Full path to psql utility binary folder,

Use the resulting path and -V option to check the current psql version:

          /usr/lib/postgresql/10/bin/psql -V        

The resulting output shows you the current psql customer version on your organization.

Psql version using the full binary path.

Decision

The provided commands and SQL statements are the virtually effective mode to determine the PostgreSQL version number. Use them to check the current version of your PostgreSQL database server or psql client utility.

Make sure that your systems are always up to date with the latest available version.

Was this article helpful?

Yes No

Source: https://phoenixnap.com/kb/check-postgresql-version

Posted by: parkernineirackly96.blogspot.com

0 Response to "How To Check If Postgres Is Installed"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel