This is yet another article relates on PostgreSQL which is focusing to show how to check the PostgreSQL version via command console. Off course, the main point is the PostgreSQL Database Server must be installed and has already started. To check whether the service has already been installed or not just do the following step :
Check the service of PostgreSQL Database Server. To grasp on how to do it, just read the article titled ‘Check PostgreSQL Service Status’ in this link.
After everything has already been checked, mainly the PostgreSQL Database Server installation, the service itself also has already running properly, the process for checking the version can be performed.
PostgreSQL Database Server’s version :
For an example :
[user@hostname ~]$ psql --version psql (PostgreSQL) 9.4.5
For an example :
[user@hostname ~]$ psql -V psql (PostgreSQL) 9.4.5 [user@hostname ~]$
So, just type either ‘psql –version’ or ‘psql -V’ to be able to see the version of the running PostgreSQL Database Server. It is done in the environment of operating system which has a CLI (Command Line Interface). So, in order to be able to check it, just access terminal or any utility available for executing the command on checking the PostgreSQL Database Server.
The execution of the command for checking the version of PostgreSQL doesn’t depend on the version of the PostgreSQL itself. It is already become the default parameter and argument provided. To be able to see all of the available parameter and argument which can be used by executing the ‘psql’ command, just type ‘psql –help’.
By executing the command ‘psql –help’ in the bash prompt, the parameter or argument which is needed to be passed together with the command ‘psql’ for printing the version of PostgreSQL Database Server will be shown as follows :
[user@hostname ~]$ psql --help psql is the PostgreSQL interactive terminal. Usage: psql [OPTION]... [DBNAME [USERNAME]] General options: ... -V, --version output version information, then exit ... For more information, type "\?" (for internal commands) or "\help" (for SQL commands) from within psql, or consult the psql section in the PostgreSQL documentation. Report bugs to <email@example.com>. [user@hostname ~]$