Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

PostgreSQL show version

PostgreSQL show version

Introduction to PostgreSQL show version

PostgreSQL show version is used to show the currently installed version of Postgresql; there are multiple commands available to show the version in PostgreSQL. Basically, the version will identify in two ways, i.e. major and minor, if suppose currently installed version on the server is PostgreSQL 9.6 in that 9 is the major version, and 6 is the minor version. PostgreSQL releases the major version once in a year; it will contain the major bug fixes and new features added.

Syntax

Below is the syntax:

  • Select version();
  • # psql –V
  • # psql –version
  • SHOW server_version;
  • Psql –U [name of user] –W [password of user] –d [name of database] –c “select version();”

Below is the parameter description syntax of the show version command.

  • Select version –This command is used to show the current version installed on the database. It will show the major and minor version release also; it will show the details of x86_64-pc-Linux-gnu, 64-bit and compiled by gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-39).
  • Show server_version() – It is used to show the currently installed version of the server.
  • Name of user –We can check the server version from the OS command line using connecting to the database; at that time, we have used the user’s name.
  • Password of user –We need to use the password of the user at the time of the show version from the OS command line. If we have set the password authentication method as trust, then there is no need to use this parameter.
  • Name of database –This is defined as using the database name to connect to the database and show the version installed on the server. If we have used user name same as the database name, there is no need to use this parameter.

How to show version in PostgreSQL?

  • The below example shows that we have no need to give any privileges to the user; any user can see the currently installed version.
  • In the below first example, we have checked all user privileges; we have seen db_test user doesn’t have any privileges on the database server. So we are using db_test user to show the current version of the database server.
  • After using this user, we are able to see the currently installed version on the database server.
  • It is possible to show the currently installed version of the database server without providing any grant to the user.

psql -U postgres –W
\du
psql -U db_test -d postgres –W
show server_version;
select version();

PostgreSQL show version output 1

Examples

Below is the example of the show version command.

1. Show version by using psql –V command 

  • The below example shows that the show version of the PostgreSQL database using the psql –V command is as follows.
  • We are using capital V letter to show the currently installed version.

psql -V

PostgreSQL show version output 2

2. Show version by using psql –version command

The below example shows the show version of the PostgreSQL Database by using the psql –version command.

psql --version

PostgreSQL show version output 3

3. Show version by connecting to database server from OS command line 

  • The below example shows the show version by connecting to the database server from the OS command line.
  • We have using the username, database name and password of the user to check the version in PostgreSQL.

psql -U db_test -d postgres -W -c "show server_version;"
psql -U db_test -d postgres -W -c "select version();"

PostgreSQL show version output 4

4. Show version by using select version() command

  • The below example shows the show version database by using the select version() command.

select version();

output 5

5. Show version by using showserver_version command 

  • The below example shows the show version of the PostgreSQL database by using the show server_version command.

show server_version;

output 6

Recommended Articles

This is a guide to the PostgreSQL show version. Here we discuss How to show version in PostgreSQL and Examples along with the commands. You may also have a look at the following articles to learn more –

  1. PostgreSQL Compare Strings
  2. PostgreSQL EXCLUDE
  3. PostgreSQL String Array
  4. PostgreSQL Import CSV

The post PostgreSQL show version appeared first on EDUCBA.



This post first appeared on Best Online Training & Video Courses | EduCBA, please read the originial post: here

Share the post

PostgreSQL show version

×

Subscribe to Best Online Training & Video Courses | Educba

Get updates delivered right to your inbox!

Thank you for your subscription

×