0
Challenge · 62The Data API & Your Next.js App
The Data API: PostgREST, exposure & grants
Queriesused in ~100% of apps
Concept 19 already warned you about one lock: GRANT. Then you spent eight concepts writing beautiful, correct RLS policies and never saw that lock again — the sandbox grants everything automatically, so RLS could be the only variable. A real Supabase migration does not do you that favor. Ship a new table exactly the way you have for 61 concepts, and the client gets back `PGRST205: Could not find the table 'public.bookmarks' in the schema cache` — for a table that, unmistakably, exists.
Core idea. supabase-js never talks to Postgres. It talks to PostgREST, a service that turns your database's own catalogs into a REST API, and PostgREST only knows about what the requesting role has been GRANTed. A table with perfect RLS and zero grants is not "protected" from the Data API's point of view — it is invisible to it, because PostgREST builds its schema cache by asking Postgres what this role can see, and Postgres's own information_schema hides objects a role has no privilege on. That is the entire reason the error is "table not found" and not "forbidden."
poke it, drag it,
try to break it
try to break it
no slides here.
you drive.
you drive.
Playground, this isn't a screenshot
Live demointeractive
Real Postgres · in your browseridle
DevLog's newest feature: bookmarking a post. Run this to add the table — as if it were a migration you just wrote. Then, in the same box, run
select has_table_privilege('authenticated', 'bookmarks', 'select');. posts got its grants at boot; this table did not exist yet when that happened. Predict the answer before you run it.Cmd/Ctrl + Enter
↑ play a little first, then dig in