@rtorcato/supabase-common / PG_ERROR_CODES
Variable: PG_ERROR_CODES
constPG_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
readonlyuniqueViolation:"23505"='23505'
foreignKeyViolation
readonlyforeignKeyViolation:"23503"='23503'
notNullViolation
readonlynotNullViolation:"23502"='23502'
checkViolation
readonlycheckViolation:"23514"='23514'
exclusionViolation
readonlyexclusionViolation:"23P01"='23P01'
insufficientPrivilege
readonlyinsufficientPrivilege:"42501"='42501'
RLS / permission denied (insufficient_privilege).
serializationFailure
readonlyserializationFailure:"40001"='40001'
Serialization failure — safe to retry.
deadlockDetected
readonlydeadlockDetected:"40P01"='40P01'
Deadlock — safe to retry.
queryCanceled
readonlyqueryCanceled:"57014"='57014'
Statement timeout (query_canceled).
connectionFailed
readonlyconnectionFailed:"PGRST000"='PGRST000'
PostgREST: could not connect to the database (503) — transient.
connectionError
readonlyconnectionError:"PGRST001"='PGRST001'
PostgREST: internal connection error (503) — transient.
schemaCacheUnavailable
readonlyschemaCacheUnavailable:"PGRST002"='PGRST002'
PostgREST: schema cache not available yet (503) — transient.
poolTimeout
readonlypoolTimeout:"PGRST003"='PGRST003'
PostgREST: timed out acquiring a pool connection (504) — transient.
noRows
readonlynoRows:"PGRST116"='PGRST116'
PostgREST: query for a single row matched zero rows.
jwtExpired
readonlyjwtExpired:"PGRST301"='PGRST301'
PostgREST: JWT expired.