Skip to main content

@rtorcato/supabase-common / PG_ERROR_CODES

Variable: PG_ERROR_CODES

const PG_ERROR_CODES: object

Defined in: errors.ts:6

The error codes a Supabase dev checks for by hand over and over: Postgres SQLSTATEs surfaced through PostgREST, plus PostgREST's own PGRSTxxx codes. Named here so callers stop sprinkling magic strings like '23505'.

Type Declaration​

uniqueViolation​

readonly uniqueViolation: "23505" = '23505'

foreignKeyViolation​

readonly foreignKeyViolation: "23503" = '23503'

notNullViolation​

readonly notNullViolation: "23502" = '23502'

checkViolation​

readonly checkViolation: "23514" = '23514'

exclusionViolation​

readonly exclusionViolation: "23P01" = '23P01'

insufficientPrivilege​

readonly insufficientPrivilege: "42501" = '42501'

RLS / permission denied (insufficient_privilege).

serializationFailure​

readonly serializationFailure: "40001" = '40001'

Serialization failure — safe to retry.

deadlockDetected​

readonly deadlockDetected: "40P01" = '40P01'

Deadlock — safe to retry.

queryCanceled​

readonly queryCanceled: "57014" = '57014'

Statement timeout (query_canceled).

connectionFailed​

readonly connectionFailed: "PGRST000" = 'PGRST000'

PostgREST: could not connect to the database (503) — transient.

connectionError​

readonly connectionError: "PGRST001" = 'PGRST001'

PostgREST: internal connection error (503) — transient.

schemaCacheUnavailable​

readonly schemaCacheUnavailable: "PGRST002" = 'PGRST002'

PostgREST: schema cache not available yet (503) — transient.

poolTimeout​

readonly poolTimeout: "PGRST003" = 'PGRST003'

PostgREST: timed out acquiring a pool connection (504) — transient.

noRows​

readonly noRows: "PGRST116" = 'PGRST116'

PostgREST: query for a single row matched zero rows.

jwtExpired​

readonly jwtExpired: "PGRST301" = 'PGRST301'

PostgREST: JWT expired.