How to simulate deadlock in PostgreSQL

If you need to test for example locks or error handling during deadlock you can use following simple example to create deadlock situation. But be aware that this is deadlock “from school book”. Nice and clean and logical. Just to see “how it...