How to get PostgreSQL Version

We have following methods to know the version of PosgreSQL running on the server.

Method1: Using psql -V in shell(Linux) or command line(Windows)

psql -V

psql (PostgreSQL) 9.6.3

Method 2: Goto the installation path and open PG_VERSION file. Which contains PostgreSQL version information.)

On Linux
postgres@ubuntu:~/9.5/main$ more PG_VERSION
9.5

On Windows
C:\Program Files\PostgreSQL\9.5\data\PG_VERSION

Method3: Using SQL statements We can get PostgreSQL Version by running select version(); or show server_version;

select version();

version ------------------------------------------------------------------------------------------------------------------ PostgreSQL 9.5.10 on x86_64-pc-linux-gnu, compiled by gcc (Ubuntu 5.4.0-6ubuntu1~16.04.4) 5.4.0 20160609, 64-bit (1 row)

show server_version;

server_version ---------------- 9.5.10 (1 row)

Method 4: Run the \! psql -V in the psql utility

postgres=# \! psql -V

psql (PostgreSQL) 9.6.3

Responses are currently closed, but you can trackback from your own site.

Comments are closed.

Powered by k2schools
%d bloggers like this: