Skip to content

Supabase database errorSupabase: “relation does not exist” (42P01)

A query that should work fails with 42P01: relation "profiles" does not exist, in the app, a trigger or the SQL editor. Usually the table is there and the query is looking in the wrong place: another schema, or a name with capital letters that an unquoted query doesn’t match. Sometimes the table was only ever created on a laptop or a staging project. Here are the three causes, in Supabase’s words, and how to tell which one you have, or hand it over at a fixed price.

Short answer

Check three things. Is the table in a schema other than public? Then name the schema in the query, such as supabase.schema('myschema').from('mytable'). Was it created with capitals, like "Profiles"? In supabase-js pass the exact name, such as .from('Profiles'); in SQL wrap it in double quotes; or rename it to lower case. Does it exist in this project at all? Run the information_schema query below against production, not your local or staging database.

Three causes, how to tell them apart, and the fix

  1. 01

    The table is in another schema

    “When directly accessing a table that is not in the public schema, it's important to reference the external schema explicitly in your query.” Supabase, Resolving 42P01: relation does not exist error

    supabase.from() looks in public. A table in your own schema needs the schema named in the query. If you then get a 42501 permission denied error, expose the schema to the API in the project settings; the role may also need grants. Supabase’s own schemas, such as auth and vault, aren’t reachable through the API at all: read them through a security definer function.

    const { data, error } = await supabase
      .schema('myschema')
      .from('mytable')
      .select()
  2. 02

    The name has capital letters

    “The double quotes make it case-sensitive, so it becomes essential to call the table with the appropriate title.” Supabase, Resolving 42P01: relation does not exist error

    A table created as "Profiles" or "userSettings", which AI tools and table imports often do, only matches when the query quotes the name exactly the same way. A function or policy that writes profiles or userSettings without quotes looks for a lower-case table that doesn’t exist. In supabase-js, pass the exact name, such as .from('Profiles'). In SQL, wrap it in double quotes.

  3. 03

    Rename it to lower case to stop the problem coming back

    “Quoting an identifier also makes it case-sensitive, whereas unquoted names are always folded to lower case.” PostgreSQL, Lexical structure: identifiers

    Renaming the table to lower case lets every query, policy and function find it without quotes. Update the app code that names it in the same change, and rename columns with capitals the same way.

    alter table "Profiles" rename to profiles;
  4. 04

    The table was never created in this project

    “One may have never made the table or dropped it deliberately or accidentally.” Supabase, Resolving 42P01: relation does not exist error

    A migration that ran on your laptop or a staging project but never on production leaves the app querying a table that isn’t there. A table someone dropped, or renamed, does the same to every trigger and function that still names it. Run this against the project the app uses:

    select table_schema, table_name
    from information_schema.tables
    where table_name ilike 'profiles';
  5. 05

    Check the fix as the app, not only in the SQL editor

    The SQL editor runs as postgres and can see every schema, so a query can work there and still fail in the app. Simon reruns the failing request from the app itself, signed in as a real user, after the fix.

Checked against the vendor’s docs on : Supabase troubleshooting: Resolving 42P01: relation does not exist error; PostgreSQL docs: identifiers and case.

Rather hand it over?

Fixed scope, fixed price, paid upfront. The work happens in writing; no call needed.

Related: Supabase table not in the schema cache (PGRST205) · Supabase migration failed on db push · Supabase “permission denied for schema auth” · A Supabase staging environment

Questions

More on this error

What is the difference between 42P01 and PGRST205?

42P01 comes from Postgres: the query reached the database and the table wasn’t found under that name. PGRST205 comes from the Data API before the query runs: the table isn’t in its schema cache, often because it was just created or its schema isn’t exposed.

The error names supabase_migrations.schema_migrations. Is that the same problem?

It is the same error with a different cause: the migration history table is missing, usually on a fresh or restored project. Supabase has a separate troubleshooting page for it, linked from the 42P01 page.

Can you fix it for me?

If one bug is the whole problem, the App Fix Ticket covers it: a written diagnosis first, then the fix. If the app has more going on, the Launch Check is a written check of the whole app. Each issue found is rated critical, high, medium or low, with where it is and how it was confirmed. No issues worth fixing, no charge. If the Launch Check finds nothing rated medium or higher, Simon refunds the full $450. You keep the report either way. This applies to the first 10 Launch Checks bought after October 30, 2026.

A different error?

Describe it and get a written quote

Send the error and what you were doing. You get a written scope, a fixed price and a timeline; Simon replies by email, usually within one business day.