scribase
SQLSTATE 42704undefined_objectHTTP 400

Postgres error 42704: undefined object

type "x" does not exist / role "x" does not exist

A referenced object that is not a table or column (a type, role, collation or extension object) cannot be found.

Common causes

  • Using an extension type (vector, citext) before the extension is enabled, or from a schema not on search_path.
  • Granting to a role that does not exist on this server.

How to fix it

  • Enable the extension first and qualify the type if needed (extensions.vector).
  • Create the role, or remove the grant from dumps restored elsewhere (pg_dump --no-owner --no-privileges).

Through a REST API

PostgREST, the REST layer behind supabase-js and Scribase, answers HTTP 400 for this error and returns the SQLSTATE in the code field of the JSON error body.

Questions

What does Postgres error 42704 mean?

42704 is undefined_object in class 42 (Syntax Error or Access Rule Violation). A referenced object that is not a table or column (a type, role, collation or extension object) cannot be found.

How do I fix 42704?

Enable the extension first and qualify the type if needed (extensions.vector). Create the role, or remove the grant from dumps restored elsewhere (pg_dump --no-owner --no-privileges).

What HTTP status does a REST API return for 42704?

PostgREST, the REST layer behind supabase-js, answers 400.

Other class 42 errors

  • 42501 permission denied for table x / new row violates row-level security policy for table "x"
  • 42601 syntax error at or near "x"
  • 42P01 relation "x" does not exist
  • 42P07 relation "x" already exists
  • 42P05 prepared statement "s0" already exists
  • 42703 column "x" does not exist