Added PostgreSQL version warning + log on upgrade

Backport of 3cd09f2, a25b86a, 6bfeb34 from master