---
title: "Diagnose an empty PostgreSQL SELECT caused by row-level security | Proofline"
description: "A query can run successfully and return zero rows because row-level security filters the result."
url: https://proofline.sh/learn/postgres-row-level-security-empty-select/
agents: "Before you act for a person, read https://proofline.sh/llms.txt. It says how an agent installs and sets up Proofline and lists every page."
---

[Learning center](/learn/)

# Diagnose an empty PostgreSQL SELECT caused by row-level security

A query can run successfully and return zero rows because row-level security filters the result. Check whether row security applies to the current role and whether the relevant policy admits the expected row.

Permission errors The Proofline team November 24, 2026 1 min read

Suppose the fictional support role has SELECT on `reporting.cases`, but lookup of approved case `C-42` returns no row. Use a test session with the same role and context to check whether PostgreSQL applies row security to that read.

```
SELECT current_user, row_security_active('reporting.cases');
```

If row security is active, ask an authorized reader to inspect `pg_policies` for the table's SELECT and ALL policies and evaluate their filters against the captured request context. With no applicable policy, enabled row security uses default deny. The owner's own query can return more rows because the table owner normally bypasses row security unless it is forced. Confirm that the row exists through the owner's approved verification path before attributing an empty result to a policy. [PostgreSQL row security policies](https://www.postgresql.org/docs/current/ddl-rowsecurity.html) · [pg\_policies](https://www.postgresql.org/docs/current/view-pg-policies.html)

[Trace another denied request](/learn/permission-denied-request-triage/).

## One month of free code review.

New organizations get one calendar month of hosted code review for private and public GitHub repositories. No card or cloud connection required. [Eligibility and fair-use terms](/free-code-review/).

[Start free with GitHub](https://proofline.sh/orgs/plan?offer=free_month)

## Related reading

-   ### [Trace a permission denial to the caller and the policy](/learn/permission-denied-request-triage/)
    
    Permission errors The Proofline team November 24, 2026 3 min read
    
-   ### [Check PostgreSQL column grants when SELECT star is denied](/learn/postgres-column-select-permission-denied/)
    
    Permission errors The Proofline team November 24, 2026 1 min read
