0

I have 2 different major versions of postgres 9 and 10 installed on rhel.

Latest situation after attempts of updating psql package: I have psql 9.2.24 installed on rhel 7.6 while the server version is 10.7. I had earlier issues with my yum repo which got corrupted and later on, i recovered/fixed it with the help of following command mentioned at here (You can get idea of what my problem was initially with corrupt yum repo)

echo 7 > /etc/yum/vars/releasever

I checked my update-alternatives at here and it is correctly referring to the psql at 10.7 directory but still I am seeing the psql old version number while connecting to existing database.

Following was the steps i followed to update the psql package:


  1. All databases were kept running.
  2. yum install postgresql10.x86_64
  3. Command mentioned in point 2, installed/upgraded whole lot of packages on machine as the yum repo was corrupted . one of the key statements in this upgrade concerning to postgres was

postgresql10 x86_64 10.7-2PGDG.rhel7 pgdg10 1.6M

Please note, I have not yet restarted any of the instance running during/before/after above update and somehow believe it has something related to the fact that until I restart(stop existing instances and start them again) all running instances of psql/db's , psql changes will not start reflecting but that is just my assumption. Could someone please help what i understood/did wrong in this upgrade process.

Nothing except above has been changed/upgraded in terms of psql/postgres. Still I have both installations of postgres: 9 and 10.

user3792812
  • 155
  • 1
  • 4
  • 13

1 Answers1

2

I did this fix few months back and I forgot that. Something similar with better answers are at here So all credits goes to answer posters there. But here is what I did to solve it:-

  1. Restarting already running postgres instances did not help.
  2. I checked which psql showed me one of the psql at /usr/bin . It was some 9 months old so definitely it was not something got installed with my yum postgres... install step mentioned in my question which made me realize that new package installation will not override it straightaway.
  3. I tried using update-alternatives --config pgsql-psql but got the same error as mentioned on the above SO answer: /usr/bin/psql exists and it is not a symlink
  4. key clue on this page is in the comment from @Alexander Gorg that ln command will not override the existing link , it needs to be removed manually. I thought of removing the symlink but then end up renaming the psql at /usr/bin to psql_org. Indeed i issued ln command during this process.
  5. Now i issued the update-alternatives command and restarted one of the instances. Correct psql was now there.

Above indeed helped fixing psql version but still other utilities pg_basebackup and others were referring to older version. I believe better approach would have been to remove the old postgresql installation. I tried to list existing postgresql version with

yum list installed | grep postgres

only shows that

postgresql10*

packages are there and I remember I have already removed older postgres version with yum erase postgres... so not sure what to remove.

Temporarily I have further solved issued by renaming other utilities in /usr/bin and then updating their alternatives.

user3792812
  • 155
  • 1
  • 4
  • 13