---
title: "Check PostgreSQL schema USAGE when a table grant already exists | Proofline"
description: "A table grant and permission to look up that table's schema are separate checks."
url: https://proofline.sh/learn/postgres-schema-usage-denied/
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/)

# Check PostgreSQL schema USAGE when a table grant already exists

A table grant and permission to look up that table's schema are separate checks. When an error names the schema, check schema USAGE for the effective role before changing the table ACL.

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

In a fictional reporting database, `report_job` has SELECT on `reporting.daily_sales`. A newly prepared query is rejected at schema lookup. An authorized operator can inspect the grants by role. Use the table OID from the catalogs to avoid relying on the job role to resolve the relation by name.

```
SELECT has_schema_privilege('report_job', n.oid, 'USAGE') AS schema_usage,
       has_table_privilege('report_job', c.oid, 'SELECT') AS table_select
FROM pg_catalog.pg_class AS c
JOIN pg_catalog.pg_namespace AS n ON n.oid = c.relnamespace
WHERE n.nspname = 'reporting' AND c.relname = 'daily_sales';
```

False and true support a schema-usage diagnosis for that role. Ask the schema owner to consider `USAGE` if the role should resolve objects there. Object privileges still apply. If the query uses an unqualified table name, check `search_path` and the intended relation as well. [PostgreSQL schema privileges](https://www.postgresql.org/docs/current/ddl-schemas.html#DDL-SCHEMAS-PRIV) · [Privilege inquiry functions](https://www.postgresql.org/docs/current/functions-info.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
