Sorry for a late reply, but I had the exact same problem and it was a bug in the Red Hat RPM package upgrade script of the sudo package. This basically means the user running Postgres cannot resolve hostname localhost. Have you tried logging in as the user running Postgres and trying to resolve localhost? In RHEL/Centos you would do this with:
su - postgres
nslookup localhost
If this returns 127.0.0.1, then something else is a problem, but if it says the hostname cannot be resolved, then you need to check permissions of /etc/hosts and /etc/nsswitch.conf, all users should be able to read those two files. You can just run:
chmod a+r /etc/hosts
chmod a+r /etc/nsswitch.conf
Another workaround would be to replace 'localhost' in postgresql.conf with '127.0.0.1'.
Regards,
Strahinja