StoicBuilder

HandbookV the OfficinaRead-only database access

Vthe Officina, Use the tools

Read-only database access

1 min readUpdated 28 November

In plain words

Read-only access is a database login or connection that can read data but can't insert, update or delete anything, so a slip, yours or your agent's, can't damage real data.

Where you see it

A separate database user with select-only rights, the read-only setting on a saved connection in a client such as DBeaver, or the read-only option when you connect the Supabase MCP server to your agent. Production gets the read-only login; your local database can have the keys to everything.

Supabase SQL Editordatabase
create role quill_viewer with login password 'a-long-random-password';grant usage on schema public to quill_viewer;grant select on all tables in schema public to quill_viewer;alter default privileges in schema public grant select on tables to quill_viewer;
A login that can read every table in public, including ones you add later, and change none of them.

What goes wrong

  1. Handing the agent full access to production

    With the postgres connection string or Supabase's secret key, an agent that misreads a task can drop a table. Give it a read-only login, and keep it off production unless you're watching.

  2. A read-only user that sees no rows

    With row-level security on, a new role only sees rows a policy allows, so the tables look empty. That's the rules working: add a select policy for that role rather than switching security off.

  3. Relying on one app's read-only switch

    A read-only setting in one client protects you in that client. The same password used anywhere else can still write, so the real protection is a login that can't.

What to tell your agent

Copy this into Lovable, Bolt, Cursor or any agent
Draft the SQL to create a read-only database role for looking at production, with select rights only, and leave the password as a placeholder I'll fill in myself. Don't put any database password in code, migrations or this chat.

Quick check

Sign in to earn +10 XP for it

You want Claude Code to look at production data while it diagnoses a bug. Which setup is safest?

Got a prompt that touches Read-only database access?

Paste it. You get a better prompt first, then the cards that explain it.

Check your own prompt

Free, no sign-up.