Postgres error and performance guides
PostgreSQL errors as they show up in Supabase and any other Postgres app: what the SQLSTATE means, how to find the statement behind it, and the schema or code change that fixes it.
- Postgres “new row for relation … violates check constraint” – find the rule and fix itWhat 'new row for relation violates check constraint' (23514) means, how to see the rule that failed, and how to change a CHECK constraint safely.
- “relation does not exist” in Postgres and Supabase – schema, quotes, search_path, cacheWhy Postgres says 'relation does not exist' (42P01) or Supabase says 'Could not find the table in the schema cache' (PGRST205) for a table you can see.
- Supabase rpc “Could not find the function … in the schema cache” and “function does not exist”Fix PGRST202 'Could not find the function in the schema cache' and 42883 'function does not exist' when calling supabase.rpc(): names, types, overloads.
- SECURITY DEFINER functions without a fixed search_path – the risk and the fixWhat Supabase's 'Function Search Path Mutable' and 'Public Can Execute SECURITY DEFINER Function' warnings mean, the real risk, and the SQL that fixes both.
- Supabase “too many connections” – Postgres slots, Supavisor limits and serverless poolsFix 'remaining connection slots are reserved', 'too many clients already' and Supavisor 'Max client connections reached' on Supabase: pooler modes, pool sizes.
- Postgres “deadlock detected” (40P01) – read it, then remove the lock-order problemWhat Postgres 'deadlock detected' (40P01) means, how to read the DETAIL lines, and the fixes that stop it: one lock order, shorter transactions, retries.
- Supabase “canceling statement due to statement timeout” (57014) – fix the query, then the limitWhy Supabase queries fail with 'canceling statement due to statement timeout' (57014), the default limits per role, and how to fix the query before raising one.
- Postgres “could not serialize access due to concurrent update” (40001) – retry or redesignWhy Postgres says 'could not serialize access due to concurrent update' (40001) under REPEATABLE READ or SERIALIZABLE, and how to retry or avoid it safely.