If I receive an alert for deadlock, what should I do? Like what analysis should I do? No way to find a root cause?
Under pg_locks, what I can analyse?
If you receive an error with a deadlock, the current transaction is dead. You have to decide whether to try again.
Within the error message you find a hint which other (not aborted) transaction was involved in the deadlock. So you have all the information you need to find the culprit.
I wonder what you are writing about. A database doesn't send email notifications. That must be a feature of some application.
So you will have to deal the the application code or its developers.
Or is it a customer sending you a message that some deadlock happened on their system? Still, you have to deal with the application code or the log files of the database system.