10

I have a doubt about my version of Postgres installed in my environment.

This is my os: CentOS Linux release 7.3.1611 (Core) In /usr/ I can see: pgsql-9.4/ folder.

But when I do: select version(); I get:

PostgreSQL 9.2.18 on x86_64-redhat-linux-gnu, compiled by gcc (GCC) 4.8.5 
20150623 (Red Hat 4.8.5-11), 64-bit

So, what version do I have?

Juan Reina Pascual
  • 3,988
  • 7
  • 21
  • 34
  • Possible duplicate of [Which version of PostgreSQL am I running?](https://stackoverflow.com/questions/13733719/which-version-of-postgresql-am-i-running) – Abdollah Oct 24 '19 at 03:29

3 Answers3

16

To determine the version of the database server, use select version() (from a connection to the database):

postgres=# select version();
                                                version                                                     
----------------------------------------------------------------------------------------------------------------
 PostgreSQL 9.2.14 on x86_64-unknown-linux-gnu, compiled by gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-16), 64-bit

To determine the version of the database client, use psql --version (from your shell command line):

$ psql --version
psql (PostgreSQL) 9.6.2

The server is where data is stored. The client is the software you use to connect to the server. They can be different versions.

jmelesky
  • 3,710
  • 1
  • 24
  • 24
  • Hi, I am getting these with Select version() --> **PostgreSQL 11devel**. With psql --version ----> **psql (PostgreSQL) 11devel** but when I do **postgres -V '---->' postgre 9.6.6** (why?).. Any Idea? – Sajjan Kumar Feb 11 '19 at 10:39
  • You likely have two different postgres installs, and a PATH that includes both directories. This is probably its own question, though, not a comment on a two year old post. :) – jmelesky Feb 11 '19 at 17:14
2

Simply check the version by this command: psql --version

Ali Tourani
  • 1,170
  • 3
  • 21
  • 31
0

You may of course have more than one instance of Postgresql. Try this sql to show your current instance location in case there is more than one

SHOW data_directory;
Slumdog
  • 470
  • 2
  • 4