Skip to main content

Module sqlstate

Module sqlstate 

Source
Expand description

Standard PostgreSQL SQLSTATE code constants.

A single source of truth for every five-character SQLSTATE string used across the codebase. Grouping follows the PostgreSQL documentation appendix (Class 00–XX). All constants are &'static str so they compose directly with pgwire::error::ErrorInfo without any allocation.

Add new codes here when a new error path needs one; never inline a literal elsewhere — a typo in a SQLSTATE string is undetectable at compile time.

Constants§

APPEND_ONLY_VIOLATION
23601 — NodeDB extension: append-only write rejected.
BALANCE_VIOLATION
23602 — NodeDB extension: balance constraint violated.
CANNOT_CLONE_MIRROR
0A000 — NodeDB extension: a mirror database cannot be cloned.
CANNOT_COERCE
42846cannot_coerce
CANNOT_CONNECT_NOW
57P03cannot_connect_now (collection is draining)
CANNOT_DROP_DEFAULT_DATABASE
0A000 — Cannot drop the built-in default database, which is immutable. Aliased to feature_not_supported per the PostgreSQL convention for unsupported DDL operations on reserved objects.
CHECK_VIOLATION
23514check_violation
CLONE_DEPENDENCY
55006 — NodeDB extension: source database has active clone dependents.
CLONE_DEPTH_EXCEEDED
54011 — NodeDB extension: clone chain depth exceeds MAX_CLONE_DEPTH.
CLONE_PREDATES_QUERY_TIME
22023 — NodeDB extension: AS OF timestamp predates the clone’s creation point; the database did not exist at that time.
CONFIGURATION_LIMIT_EXCEEDED
53400configuration_limit_exceeded (quota exceeded)
DATABASE_DROPPED
57P04database_dropped (not-leader redirect; client should retry elsewhere)
FEATURE_NOT_SUPPORTED
0A000feature_not_supported
FOREIGN_KEY_VIOLATION
23503foreign_key_violation (dangling-edge rejection)
INSUFFICIENT_PRIVILEGE
42501insufficient_privilege
INTEGRITY_CONSTRAINT_VIOLATION
23000integrity_constraint_violation (generic)
INTERNAL_ERROR
XX000internal_error
INVALID_AUTHORIZATION
28000invalid_authorization_specification (no valid credentials)
LEGAL_HOLD_ACTIVE
23607 — NodeDB extension: legal hold blocks deletion.
LOCK_NOT_AVAILABLE
55P03lock_not_available (no cluster leader)
MOVE_TENANT_ALREADY_AT_TARGET
02000no_data: tenant is already present in the target database; the MOVE TENANT is a no-op (idempotent retry of a completed move).
MOVE_TENANT_CUTOVER_FAILED
XX000 — internal error during cutover phase; source still holds data.
MOVE_TENANT_DRAIN_TIMEOUT
57014query_canceled: drain phase timed out; client should re-try after ensuring the tenant has no active connections on the source database.
MOVE_TENANT_PREFLIGHT_FAILED
55P02lock_not_available: pre-flight check found schema incompatibility between the source and target databases; no state was mutated.
MOVE_TENANT_SNAPSHOT_FAILED
XX000 — internal error during snapshot phase; source left unchanged.
NOT_NULL_VIOLATION
23502not_null_violation
NO_DATA
02000no_data (document / row not found)
NUMERIC_VALUE_OUT_OF_RANGE
22003numeric_value_out_of_range
OUT_OF_MEMORY
53200out_of_memory
PERIOD_LOCKED
23603 — NodeDB extension: period lock; writes rejected.
PROGRAM_LIMIT_EXCEEDED
54000program_limit_exceeded (generic over-cap)
QUERY_CANCELED
57014query_canceled (deadline exceeded)
QUOTA_EXCEEDED
53400configuration_limit_exceeded: tenant or database has exhausted its configured resource budget (TENANT_QUOTA_EXCEEDED, DATABASE_QUOTA_EXCEEDED). Class 53 is preferred over 54 because the limit is a runtime configuration setting, not a hard-coded program limit.
QUOTA_OVERCOMMIT
53400configuration_limit_exceeded: sum of tenant/database quotas would exceed the configured global or parent ceiling (QUOTA_OVERCOMMIT). Alias for CONFIGURATION_LIMIT_EXCEEDED.
RETENTION_VIOLATION
23606 — NodeDB extension: retention policy blocks deletion.
SERIALIZATION_FAILURE
40001serialization_failure (write conflict; client should retry)
SERVER_OVERLOAD
57P03cannot_connect_now: server is under global resource pressure and cannot accept new requests (SERVER_OVERLOAD). Using 57P03 rather than 53300 (too_many_connections) because the condition is transient and the server may accept requests again shortly — clients should retry after backoff.
STALE_READ_NOT_LEADER
55P03 — NodeDB extension: a strong or bounded-staleness read was requested on a mirror database that cannot satisfy the requested consistency level.
STATEMENT_TOO_COMPLEX
54001statement_too_complex (fan-out / rate limit exceeded)
STATE_TRANSITION_VIOLATION
23604 — NodeDB extension: state-transition constraint violated.
SUCCESS
00000successful_completion
SYNTAX_ERROR
42601syntax_error
TOO_MANY_CONNECTIONS
53300too_many_connections (closest match for rate-limit denial)
TRANSITION_CHECK_VIOLATION
23605 — NodeDB extension: transition-check constraint violated.
TYPE_GUARD_VIOLATION
23608 — NodeDB extension: type-guard constraint violated.
UNDEFINED_TABLE
42P01undefined_table (collection not found)
UNIQUE_VIOLATION
23505unique_violation
WARNING
01000warning (generic warning)