PG
PRO
01006WARNINGTier 3 — Handle with care✅ HIGH confidence

privilege not revoked

Category: WarningVersions: All Postgres versions

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
REVOKE DELETE ON employees FROM analyst; -- analyst never had DELETE
WARNING: privilege not revoked

Fix 1: Verify role privileges before revoking

When writing privilege management scripts.

fix
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 docs: https://www.postgresql.org/docs/current/errcodes-appendix.html

🔧 Source ref: Class 01 — Warning

Confidence assessment

✅ HIGH confidence

Standard SQL warning. Stable across all Postgres versions.

See also

📄 Reference pages

GRANTREVOKE
⚙️ This error reference was generated with AI assistance and reviewed for accuracy. Examples are provided to illustrate common scenarios and may not cover every case. Always test fixes in a development environment before applying to production. Spotted an error? Suggest a correction →