Alternatives needs to be set to auto when you upgrade from 4.16.05 or below to latest version

Problem statement:

As part of 4.16.09 postgres server is getting upgraded to version 9.4 and as a part of 18.01 it is getting upgraded to version 9.6.

If system do not have alternatives set to auto postgres binaries will still point to older version of postgres and upgrade might fail.

Also when you login to postgres you will see following message if binaries are not updated to latest version:

psql -h localhost -p 5432 -U apigee 
Password for user apigee: 
psql (9.3.6, server 9.4.13) 
WARNING: psql major version 9.3, server major version 9.4. Some psql features might not work. Type "help" for help. 

Solution:

1. Check if postgres alternatives are set to auto using following command:

update-alternatives --get-selections | grep postgresql
OR
update-alternatives --display psql
2. If it is set to manual set it to auto using following command:
update-alternatives --auto psql 
Version history
Last update:
‎04-20-2018 08:33 AM
Updated by: