postgres was not the same version as pg_ctl in PostgreSQL 12
As per the log files, I am getting the below errors.
The program "postgres" was found by "/usr/lib/postgresql/12/bin/pg_ctl"
but was not the same version as pg_ctl.
Check your installation.
I am running Ubuntu 20.04.
Executed the following commands:
/usr/lib/postgresql/12/bin/postgres –version
postgres (PostgreSQL) 12.16 (Ubuntu 12.16-0ubuntu0.20.04.1)
/usr/lib/postgresql/12/bin/pg_ctl –version
pg_ctl (PostgreSQL) 12.15 (Ubuntu 12.15-0ubuntu0.20.04.1)
Do I need to update or perform some tasks as this has rendered my DB Server useless and I have some databases which I am not able to access?
Since I could not restart my PostgreSQL Server, I decided to copy the data files in /etc/postgresql/12/main
to another server and check if it worked.
While trying to test this on a new Server, I installed the same version of PostgreSQL 12 and then tried checking the version info of the pg_ctl and postgres.
postgres (PostgreSQL) 12.16 (Ubuntu 12.16-0ubuntu0.20.04.1)
pg_ctl (PostgreSQL) 12.16 (Ubuntu 12.16-0ubuntu0.20.04.1)
I was surprised the versions were the same, unlike in my present server. So, I copied the binary files from my new server to my old one from the location /var/lib/postgresql/12
.
Once this was done, my PostgreSQL started without any issues or complaints. I know this may not be the best approach, but it worked and allowed me to take a dump of the data.
However, the question remains about how the version changed for the old server.