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.