Restrict root user access to postgres user
You cannot do what you are asking.

Here's what you should do instead:


Run your database on its own computer in its own network segment. Don't run anything else on that computer (save backup / monitoring agents)
Use a separate management network for server management / backup / monitoring
Send your db + os security logs to another machine and use a software tool to monitor them and send alerts
Don't connect to database from web servers as a superuser