Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

SQLSTATE reference

Amphi returns a five-character SQLSTATE with every server error. Clients should branch on the code, not on localized message text. The list below covers the codes currently emitted by the parser, binder, planner, executor, session, lock manager, and wire protocol.

Syntax and statement structure

SQLSTATEConditionTypical source
42601syntax errorinvalid SQL or lexical input
54000program limit exceededoversized value, work memory, or recursive limit
54001statement too complexexcessive parser nesting
0A000feature not supportedvalid syntax outside the implemented surface

Names, objects, and types

SQLSTATECondition
3F000invalid schema name
42P01undefined table or relation
42P02undefined parameter
42701duplicate column
42702ambiguous column
42703undefined column
42704undefined object
42710duplicate object
42712duplicate alias
42725ambiguous function
42803grouping error
42804datatype mismatch
42809wrong object type
42846cannot coerce
42883undefined function
42P06duplicate schema
42P07duplicate table or relation
42P10invalid column reference
42P16invalid table definition
42P18indeterminate datatype
42939reserved name
2BP01dependent objects still exist

Data and constraint errors

SQLSTATECondition
22003numeric value out of range or arithmetic overflow
22012division by zero
2201Winvalid LIKE pattern escape
22P02invalid text or binary representation
23502not-null violation
23505unique violation
23514check violation
42804datatype mismatch

Concurrency, resources, and cancellation

SQLSTATECondition
25P02current transaction is aborted
25P04transaction timeout
40001serialization failure or concurrent update
40P01deadlock detected
53200out of shared memory, including row-lock capacity
53100disk full
55P03lock not available or lock timeout
57014query or statement canceled

Internal and protocol errors

SQLSTATECondition
08P01protocol violation
08006connection failure
XX000internal error, corruption, or unexpected I/O failure

SQLSTATEs are also included in protocol ErrorResponse messages, client errors, logs, and test fixtures. New error paths must choose an existing compatible code or add a documented code before they are exposed to clients.