Test RLS for role
test_rls_for_roleTest which rows a PostgreSQL role can read under row-level security. Inspect RLS status, policies, and sample data without writes.
Instructions
Test what an RLS-bound role can read from a table. Reports whether RLS is enabled on the table, lists the policies that apply to the given role, counts the rows the role can read, and returns up to sample_size rows so the agent can inspect them. Runs as the target role inside a READ ONLY transaction — no writes can leak. Pure read.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| role | Yes | ||
| table | Yes | ||
| schema | Yes | ||
| database | No | Optional: target a configured secondary (read-only) database by name; omit for the primary. Call list_databases to see the configured ids. | |
| sample_size | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| role | Yes | ||
| table | Yes | ||
| sample | Yes | ||
| schema | Yes | ||
| columns | Yes | ||
| rls_enabled | Yes | ||
| rows_visible | Yes | ||
| active_policies | Yes |