Fix · Supabase and databases
My query returns an empty list but the data is in the table
Blocks your work
What you may see
- The table has rows in the dashboard but my app shows nothing, with no error
- It works when I am the admin, not for visitors
Most likely cause
Row level security hides rows from the role that asks (no select policy), so the answer is empty rather than an error.
Check first (about two minutes)
- Check whether the user is logged in at that moment and which role the call uses.
- Look in the table's policies for a SELECT policy.
The fix prompt
What you type here never leaves your browser. The search runs on this page, and nothing is sent to a server or to an AI.
Kept only in this browser, on this device. Keys and passwords are removed before anything is saved.
Prompt language
Paste it into Claude, ChatGPT, Gemini or Cursor, then follow what it says.
After you tried it, did it work?
Steps
- Check the table has row level security on and list its select policies.
- Test the same query as anon and as a logged-in test user (not as the admin) and tell me which one returns rows.
- Write the narrowest select policy for the rows that role should see (for example published = true, or user_id = auth.uid()).
- Also check filters, the table name and the project address in the app.
Do not do this
- Do not use using (true) on a table that has private columns.
- Do not use the service key in the browser to see the rows.