Changes for postgresql, CentOS and incorporated fix from github.com:diddi-