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 the transaction-specific codes, the ones you hit because two sessions collided over the same rows, not because a query had a typo. They come in cross-engine pairs, because the underlying situations are the same on both databases even when the numbers aren't.

The cross-engine pairs

Read across a row to see how PostgreSQL and MySQL each name the same situation.

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 snapshot write lost a race and was refused40001 could not serialize accessnone; surfaces as 1213 / 1205 instead
A statement ran past its time limit57014 statement timeoutnone; max_execution_time, not in the proven set

The two "none" cells are honest gaps, not omissions. PostgreSQL's snapshot-based 40001 has no lock-based twin in InnoDB, and MySQL's max_execution_time isn't exercised by any scenario on this site yet, so no page here claims its code.

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.4 at c52e5c9, and re-proven through psycopg and PyMySQL.