01006
PostgreSQLWARNINGCriticalWarningHIGH confidence

privilege not revoked

What this means

SQLSTATE 01006 is raised when a REVOKE statement attempts to remove a privilege that the target role does not actually hold. The command completes without effect.

Why it happens
  1. 1REVOKE statement targeting a role that does not hold the specified privilege
How to reproduce

Revoking a privilege that was never granted.

trigger — this will error
trigger — this will error
REVOKE DELETE ON employees FROM analyst; -- analyst never had DELETE

expected output

WARNING:  privilege not revoked

Fix

Verify role privileges before revoking

WHEN When writing privilege management scripts.

Verify role privileges before revoking
SELECT grantee, privilege_type FROM information_schema.role_table_grants
WHERE table_name = 'employees' AND grantee = 'analyst';

Why this works

Confirm the privilege exists before attempting to revoke it.

Sources
Official documentation ↗

Class 01 — Warning

Content generated with AI assistance and reviewed for accuracy. Found an error? hello@errcodes.dev

← All PostgreSQL errors