-2

I have updated postgres from 9.5.4 to the latest 10.4 on Ubuntu 14.

But after installing postgres 10 I am seeing

support@platform1:/usr/bin$ ls -lah pg_ctl
lrwxrwxrwx 1 root root 34 Jun 13 08:59 pg_ctl -> /usr/lib/postgresql/9.5/bin/pg_ctl

The issue appears similar to the one discussed here. I cannot use the answer mentioned there as there is a DB in use. So I have to keep 9.5 also installed along with 10 till data migration is performed as pg_upgrade needs both 9.5 & 10 binaries to perform the migration.

To install postgres 10 I have followed the below steps:-

sudo add-apt-repository "deb http://apt.postgresql.org/pub/repos/apt/ trusty-pgdg main"
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
sudo apt-get update
sudo apt-get install postgresql-10

Then performed the data migration using pg_upgrade and then removed postgres 9.5

pg_ctl is not working as it is pointing to the old 9.5 installation which has been deleted now.

posgres -V is also failing with the below error

support@platform1:/usr/bin$ postgres -V
The program 'postgres' is currently not installed. You can install it by typing:
sudo apt-get install postgres-xc

Can someone let me know what is wrong and how can I fix it?

  • 2
    Your question contains conflicting information. " I have to keep 9.5 also installed along with 10 till data migration is performed." vs "To install postgres 10 I have followed the below steps ... Then performed the data migration using pg_upgrade and then removed postgres 9.5". Very confusing – Philᵀᴹ Aug 11 '18 at 20:28
  • In the link I posted in my question it is said to remove old postgres completely before starting with the installation of new one. But in my case I have a postgres 9.5 DB. So I have to do data migration using pg_upgrade. pg_upgrade needs both old and new binary at the same time to perform the migration. Let me know if something is still not clear. – tuk Aug 12 '18 at 2:53
  • all the typoes in the important details don't help. – Jasen Aug 12 '18 at 3:51
-1

Yeah once you have upgraded the Postgresql, still your environment PATH points to the Old path. Do the following things.

For eg: Your pg_ctl for PG10 might be located in /usr/share/pg10/bin/pg_ctl.

So you need to export this Path.

export PATH=/usr/share/pg10/bin/$PATH

And, remove the older version then logout and login.

| improve this answer | |
  • This isn't needed when installing from the Postgres APT repository. – Colin 't Hart Aug 13 '18 at 11:28
0

If installing from the Postgres APT repository, you should be using pg_ctlcluster as it is aware of multiple versions installed simultaneously.

In addition, postgres is not installed in a location that is in the default PATH. This is by design; end-users don't need to run it, as it's started and stopped by pg_ctlcluster.

| improve this answer | |

Not the answer you're looking for? Browse other questions tagged or ask your own question.