title: Postresql SQL State: 25P02 Deadlock?
body: <p>My task is to create a deadlock with two SQL Transactions. I work in PgAdmin.
  The task says:
  "Create two SQL transactions that can be executed
  interactively (annotate in comments in which order the transactions should be interleaved) to
  create a deadlock and explain the reason of the deadlock."
  I tried to create it and read about it online, but this is the only error I get when trying to make two processes go at the same time without COMMIT/ROLLBACK.
  I get this error message:</p>
  
  <pre><code>    ERROR:  current transaction is aborted, commands ignored until end of transaction block
      SQL state: 25P02
  </code></pre>
  
  <p>If that is not deadlock, can you help me make one?</p>
  
  <p><a href="http://zarez.net/?p=1069" rel="nofollow noreferrer">http://zarez.net/?p=1069</a></p>
  
  <pre><code>    CREATE TABLE deadlock_example_table_1 (column1 int)
  
      CREATE TABLE deadlock_example_table_2 (column1 int)
  
      INSERT INTO deadlock_example_table_1 (column1)
      SELECT 1
      UNION ALL
      SELECT 2
      UNION ALL
      SELECT 3
      GO
  
      INSERT INTO deadlock_example_table_2 (column1)
      SELECT 1
      UNION ALL
      SELECT 2
      UNION ALL
      SELECT 3
      GO
  
      BEGIN;
      DELETE FROM deadlock_example_table_1 WHERE column1 = 2
  
      BEGIN;
      DELETE FROM deadlock_example_table_2 WHERE column1 = 2
  </code></pre>
  
  <p><a href="https://medium.com/@clairesimmonds/postgresql-decoding-deadlocks-183e6a792fd3" rel="nofollow noreferrer">https://medium.com/@clairesimmonds/postgresql-decoding-deadlocks-183e6a792fd3</a>
  I was thinking the output should look something like in this article.</p>
  
  <pre><code>    ERROR: deadlock detected
      DETAIL:  Process 16121 waits for AccessExclusiveLock on relation 17389 of database 16390; blocked by process 15866.
      Process 15866 waits for AccessShareLock on relation 17309 of database 16390; blocked by process 16121.
      HINT:  See server log for query details.
  </code></pre>