Logo
  • Ubuntu
  • CentOS
  • Debian
  • Fedora
  • RedHat

How to Check the PostgreSQL Version - DesignLinux

Jun 23 2020
designlinux 0 Comments
How to Check the PostgreSQL Version

PostgreSQL is also known as Postgres and it’s an open-source object-relational database management system. It is important to know the version of the PostgreSQL server which is installed on your system when your application is based on specific version. This tutorial will show you how to check the PostgreSQL server version which is running on your system.

Check PostgreSQL Version#

PostgreSQL major releases with new features are usually delivered once a year. Each major release is supported for 5 years.

Using the Command Line#

You can check the which PostgreSQL version is running on your system using command line by invoking postgres command with --version or -V option:

postgres --version

It will show you output like below:

postgres (PostgreSQL) 12.3

At the time of writing this article, the latest version of postgres is 12.3.

If you will get an error saying “postgres: command not found”, that means you have not postgres binary in system’s PATH or the PostgreSQL package is not installed from the distribution’s standard repositories.

To find the path to the binary either with the locate or find command:

sudo find /usr -wholename '*/bin/postgres'
sudo updatedb
locate bin/postgres

Output will looks like below:

/usr/lib/postgresql/12/bin/postgres

Now you can use the path to the binary, to get the version of the PostgreSQL server:

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

To know the version of PostgreSQL client utility use psql as following:

psql --version

It will print output as below:

postgres (PostgreSQL) 12.3

psql is an interactive command-line utility that allows you to interact with the PostgreSQL server.

Using the SQL Shell#

Alternate way to get the PostgreSQL server version is by logging in to the SQL server prompt and print out the version using an SQL statement.

Access the PostgreSQL shell using with psql:

sudo -u postgres psql

Following statement displays the PostgreSQL server version along with the build information:

SELECT version();
PostgreSQL 12.3 on x86_64-unknown-linux-gnu, compiled by gcc (Ubuntu 4.8.2-19ubuntu1) 4.8.2, 64-bit
(1 row)

To get the only PostgreSQL server version number type:

SHOW server_version;
 server_version 
----------------
 12.3
(1 row)

Conclusion#

We have shown you different ways to determine the PostgreSQL server version which is running on your system.

If you have any questions or suggestion, please leave a comment below.

Related

Tags: postgresql

How to Make Minecraft Server on Ubuntu 20.04

Prev Post

How to Install Skype on Debian 10 Buster

Next Post
Archives
  • January 2023
  • December 2022
  • November 2022
  • October 2022
  • September 2022
  • July 2022
  • June 2022
  • April 2022
  • March 2022
  • February 2022
  • January 2022
  • December 2021
  • November 2021
  • October 2021
  • September 2021
  • August 2021
  • July 2021
  • June 2021
  • May 2021
  • April 2021
  • March 2021
  • February 2021
  • January 2021
  • December 2020
  • November 2020
  • October 2020
  • September 2020
  • August 2020
  • July 2020
  • June 2020
  • May 2020
Categories
  • AlmaLinux
  • Android
  • Ansible
  • Apache
  • Arch Linux
  • AWS
  • Backups
  • Bash Shell
  • Bodhi Linux
  • CentOS
  • CentOS Stream
  • Chef
  • Cloud Software
  • CMS
  • Commandline Tools
  • Control Panels
  • CouchDB
  • Data Recovery Tools
  • Databases
  • Debian
  • Deepin Linux
  • Desktops
  • Development Tools
  • Docker
  • Download Managers
  • Drupal
  • Editors
  • Elementary OS
  • Encryption Tools
  • Fedora
  • Firewalls
  • FreeBSD
  • FTP
  • GIMP
  • Git
  • Hadoop
  • HAProxy
  • Java
  • Jenkins
  • Joomla
  • Kali Linux
  • KDE
  • Kubernetes
  • KVM
  • Laravel
  • Let's Encrypt
  • LFCA
  • Linux Certifications
  • Linux Commands
  • Linux Desktop
  • Linux Distros
  • Linux IDE
  • Linux Mint
  • Linux Talks
  • Lubuntu
  • LXC
  • Mail Server
  • Manjaro
  • MariaDB
  • MongoDB
  • Monitoring Tools
  • MySQL
  • Network
  • Networking Commands
  • NFS
  • Nginx
  • Nodejs
  • NTP
  • Open Source
  • OpenSUSE
  • Oracle Linux
  • Package Managers
  • Pentoo
  • PHP
  • Podman
  • Postfix Mail Server
  • PostgreSQL
  • Python
  • Questions
  • RedHat
  • Redis Server
  • Rocky Linux
  • Security
  • Shell Scripting
  • SQLite
  • SSH
  • Storage
  • Suse
  • Terminals
  • Text Editors
  • Top Tools
  • Torrent Clients
  • Tutorial
  • Ubuntu
  • Udemy Courses
  • Uncategorized
  • VirtualBox
  • Virtualization
  • VMware
  • VPN
  • VSCode Editor
  • Web Browsers
  • Web Design
  • Web Hosting
  • Web Servers
  • Webmin
  • Windows
  • Windows Subsystem
  • WordPress
  • Zabbix
  • Zentyal
  • Zorin OS
Visits
  • 2
  • 1,235
  • 616,924

DesignLinux.com © All rights reserved

Go to mobile version