I discovered that one of the memory sticks in the machine was damaged.
Running memtest86 on the machine generated many RAM errors.
This was causing the strange bi-polar errors in postgresql.
The hardware technician explained that he sees this often and that there is no one cause for such problems.
As I am not a hardware specialist, I never thought that RAM could cause such problems.
I always assumed that the OS (ubuntu or windows) would advise me if there was ever an issue with memory.
TAKE AWAY:
As a result of this I will be checking the RAM on all my machines once a month or the moment a machine starts to act strange.
Thanks again to all who helped with this issue.