Fixes › Database / Supabase RLS
Postgres error: relation "public.xyz" does not exist
The error
ERROR: 42P01: relation "public.profiles" does not exist / PostgREST could not find the table
Why it happens
The AI builder wrote TypeScript that queries a table, but the CREATE TABLE migration was never run on this Supabase project (or was run on a different project). Local/SQL editor and production can also point at different databases. PostgREST only exposes tables that exist in the linked project's schema cache.
How to fix it
- Open Supabase → Table Editor and confirm the table is missing on this project.
- Find the migration or SQL the AI generated (often in supabase/migrations or a setup.sql).
- Run it in the SQL Editor for the SAME project whose URL/anon key your app uses, or use supabase db push.
- In Project Settings → API, click 'Reload schema' if the table exists but the API still 404s.
- Double-check NEXT_PUBLIC_SUPABASE_URL matches this project, not a leftover demo project.
Fix prompt (paste into Lovable, Bolt, Cursor, Replit or v0)
My app errors with relation "<TABLE>" does not exist against Supabase. Do not invent a different schema. Locate every CREATE TABLE / migration for that table, give me one idempotent SQL migration I can paste into the Supabase SQL Editor, list any RLS policies the table needs so selects/inserts work after creation, and tell me how to verify the app's SUPABASE_URL points at the project where I ran the SQL.
FAQ
The table is in my code / types. Why fail?
Types and UI don't create database objects; only a migration or SQL run does.
It works for my teammate.
They likely ran the migration on their project, or you're using different SUPABASE_URL values.
Related fixes
- Supabase query returns an empty array (no error)
- new row violates row-level security policy for table
- Supabase Edge Function fails with CORS or 'Failed to send a request'
- Supabase Storage upload fails: new row violates row-level security policy (403)
Want the full checklist for this area? Get a Fix Kit ($29)
Featured slot available: reach thousands of vibe coders. Sponsor this week →
Get one new fix a week
Free newsletter: the newest breakages in Lovable, Bolt, Cursor, Replit and v0 apps, with paste-in fixes.
We only use your email to send the newsletter. Unsubscribe any time. See privacy.