TECHNOLOGY

An empty PostgREST list can be the role’s valid visible set

In this article
THE QUICK TAKE

Distinguish the role’s visible result set from table existence, query filtering and actual request errors; an empty successful list does not describe the whole database.

Read the result under the request’s role

A research client receives an empty list of source collections while an administrator sees stored rows. PostgREST’s authentication guide places authorization in the database and switches requests into an appropriate role. A successful empty list can be the correct result under that role. Do not conclude that the database is empty or that the API has lost data solely from this response.

Distinguish row visibility from object privileges

PostgreSQL’s row-security guide adds per-row policy decisions to ordinary table privileges. When row security is enabled without an applicable policy, its default-deny behavior can leave no rows visible. That is different from a query that cannot access the table at all. Preserve actual request errors rather than normalizing them into an empty collection; conversely, do not relabel a valid policy-filtered empty set as an authentication error.

Trace authenticated and anonymous context

The authentication guide describes a valid role-bearing token selecting its database role and requests without that role context using the configured anonymous role. Inspect the effective role and relevant policy inputs for the actual request. A user’s name in a prompt or client-side page is not evidence of the database role used. Comparing an administrative query can also mislead because table owners and roles with bypass privileges may see rows hidden from ordinary requests.

Review ordinary filters as another cause

The table and view API reference describes horizontal filters that further select results. The effective role may have visible collections while the query’s owner, status or text condition excludes them. Keep the requested predicates with the role context when diagnosing emptiness. Progressive reading helps trace a client-generated filter into the actual request rather than assume the screen’s visible label fully describes the query.

Explain visibility without exposing another role’s data

Record whether the request succeeded, its intended role and the conditions defining its result. Tool observations can retain those facts without putting credentials into the report. The useful explanation distinguishes no visible matches, a policy configuration issue and an actual denied or invalid request. It establishes what this caller could read, while leaving claims about all stored collections to an appropriately authorized observation with a separately stated scope.

Earn rental income from GPUs

Have idle GPUs or looking to fund AI infrastructure? Retrivium finds a rental platform, sets up the server and helps you assess income and costs with a pilot.

Explore GPU hosting
← All articles