Resolving 42P01: relation does not exist error #29577
TheOtherBrian1
announced in
Troubleshooting
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
This is a copy of a troubleshooting article on Supabase's docs site. It may be missing some details from the original. View the original article.
42P01is a Postgres level error, that can also be found in the PostgREST error docs42P01: relation "<some table name>" does not existThere are a few possible causes
Cause 1: Search path broken
When directly accessing a table that is not in the
publicschema, it's important to reference the external schema explicitly in your query. Below is an example from the JS client:If after calling the table directly, you get a
42501permission denied error, then you must also expose the custom schema to the API.. For Supabase managed schemas, such asvaultandauth, these cannot be directly accessed through the DB REST API for security reasons. If necessary, they can be strictly accessed through security definer functions.Cause 2: Ignoring capitalization and other typos
The table could be defined as: CREATE TABLE “Hello”`. The double quotes make it case-sensitive, so it becomes essential to call the table with the appropriate title. It is possible to change the table name to be lowercase for convenience, either in the Table Editor, or with raw SQL:
Cause 3: Table or function does not exist
One may have never made the table or dropped it deliberately or accidentally. This can be checked with the following query:
Beta Was this translation helpful? Give feedback.
All reactions