Skip to content

Database error codes, reproduced ​

You didn't search for "deadlock." You pasted the number your database threw at you. This is the page that answers by that number: for each concurrency-control code below, there's a page with a one-sentence explanation, the shortest reproduction that emits it, and a link to a verified transcript of a real run.

These seven are reproduced here, not an exhaustive error list. Statement timeout can occur without another session. Similar symptoms across engines do not imply identical rollback scope, timing, or recovery.

The cross-engine pairs ​

Read across a row for related symptoms, then follow the page for operation and configuration limits. The SQL snippets are schedule excerpts; their linked full Scenarios contain setup and assertions.

What happenedPostgreSQLMySQL
Two transactions locked each other in a cycle40P01 deadlock detected1213 Deadlock found
A statement waited too long for a row lock55P03 lock timeout1205 lock wait timeout
A NOWAIT request refused to queue for a lock55P03 (same code)3572 statement aborted
A post-snapshot target change or serialization dependency rejects an attempt40001 serialization failureno identical snapshot rule; 1213 also has SQLSTATE 40001
A statement ran past its time limit57014 statement timeoutnone; max_execution_time, not in the proven set

InnoDB SERIALIZABLE locking is not PostgreSQL's snapshot/SSI conflict rule. Waits can succeed or fail, so this comparison does not predict a MySQL error for every PostgreSQL 40001 schedule. MySQL's SELECT-limit error 3024 is documented but not emitted here; the timeout Scenario asserts SLEEP interruption. Recovery of a failed PostgreSQL BEGIN block differs from InnoDB statement rollback and configuration-dependent timeout rollback.

By engine ​

On PostgreSQL: 40001 · 40P01 · 55P03 · 57014.

On MySQL: 1213 · 1205 · 3572.

MIT Licensed · Every transcript on this site was generated by a real database run against MySQL 8.4.11 and PostgreSQL 18.6 at 8fa27b8; shared YAML has an independent psycopg/PyMySQL check.