A Cycle Cannot Resolve by Waiting
A deadlock is a cycle of waits. For example, if A locks row 1 and waits for row 2 while B locks row 2 and waits for row 1, each waits on the other forever. PostgreSQL detects this cycle and aborts one of the transactions to break it. Acquiring locks in a consistent order and keeping transactions short both reduce the chance of this cycle forming, though applications still need retry handling.
What should happen to the transaction PostgreSQL aborts?