Postgresql – Postgres upgrade issue from 9.3 to 9.4

postgresql

I upgraded Postgres from 9.3 to 9.4. But when I login to server then it is showing 9.3.

see the screenshot details below:

$ psql --version
psql (PostgreSQL) 9.4.10
$ pg_dump --version
pg_dump (PostgreSQL) 9.4.10
$psql
psql (9.4.10, server 9.3.13)
Type "help" for help.

postgres=# select version();
                                                           version                                                    
--------------------------------------------------------------------------------------------------------------
PostgreSQL 9.3.13 on x86_64-unknown-linux-gnu, compiled by gcc (Ubuntu 4.8.4-2ubuntu1~14.04.1) 4.8.4, 64-bit
        (1 row)

How can I upgrade it? What is the issue?

Updated:
After running pg_lsclusters, it is showing:

pg_lsclusters
Ver Cluster Port Status Owner    Data directory               Log file
9.3 main    5432 online postgres /var/lib/postgresql/9.3/main /var/log/postgresql/postgresql-9.3-main.log

Best Answer

You didn't upgrade the database. You're likely on a system that permits different versions of PostgreSQL to run concurrently and you likely have two versions of the server running on two different ports. Usually 5432..543x. You'll have to

  1. use pg_dump on the server running with the old port (the one you're connecting to here).
  2. use pg_restore on the server running with the new port (that you probably didn't even know was running)

Try

sudo rgrep -i "port =" /etc/postgresql

Or, if you have Debian/Ubuntu, run pg_lsclusters