# 01006 — privilege_not_revoked

> PostgreSQL SQLSTATE 01006 is emitted as a WARNING when a REVOKE operation removes none or not all of the requested privileges.
---

# 01006 — privilege_not_revoked

## At a glance {#at-a-glance}

`01006` has confirmed PostgreSQL 18.6 `WARNING` paths in `src/backend/catalog/aclchk.c` for `REVOKE`. It reports a partial or empty privilege change; the command can complete while sending the warning.

<!-- BEGIN SQLSTATE FACTS: generated by scripts/generate.py; do not edit -->

| Field | Value |
| --- | --- |
| SQLSTATE | `01006` |
| Condition | `privilege_not_revoked` |
| Status | `active` |
| Known present by | `8.0.0` |
| Locked snapshots | `9.0.23, 9.1.24, 9.2.24, 9.3.25, 9.4.26, 9.5.25, 9.6.24, 10.23, 11.22, 12.22, 13.23, 14.24, 15.19, 16.15, 17.11, 18.6, 19beta3` |
| Macros | `ERRCODE_WARNING_PRIVILEGE_NOT_REVOKED` |
| Aliases | `—` |

<!-- source facts: data/errcodes/01006.json -->
<!-- END SQLSTATE FACTS -->

## Meaning {#meaning}

The confirmed 18.6 implementation is the ACL command path for REVOKE. It distinguishes no privilege revoked from not all privileges revoked and uses column-specific and object-specific templates.

## Messages and diagnostics {#messages}

The fixed 18.6 paths use these primary templates: `no privileges could be revoked for column "%s" of relation "%s"`, `no privileges could be revoked for "%s"`, `not all privileges could be revoked for column "%s" of relation "%s"`, and `not all privileges could be revoked for "%s"`. They have no detail or hint in the resolved groups.

## Diagnosis {#diagnosis}

Record whether the target was a column or an object and the resolved relation/object name. In the fixed `aclchk.c` function, `this_privileges` is the requested set intersected with the effective grantor's available grant options. The `REVOKE` warning is `none` when that mask is zero, and `partial` when `!all_privs` and the mask differs from the request; this warning branch does not inspect the grantee's old ACL. Inspect the effective grantor, grant options, requested privileges, and then the resulting ACL separately. A `WARNING` is distinct from an `ERROR` that aborts the command.

## Response {#response}

Treat the command result and warning separately. If the intended access change was not achieved, correct the target role/object or requested privilege and verify the resulting ACL; repeating REVOKE without changing the mismatch may produce the same warning.

## Versions {#versions}

`01006` is present from the locked 9.0.23 snapshot through 18.6 and 19 Beta 3, with `known_present_by` 8.0.0. The fixed 18.6 warning paths are in `aclchk.c`; this is not a claim that every historical version used identical wording.

## Related {#related}

[`01007`](../01007/) is the corresponding privilege-not-granted warning; [`42501`](../42501/) is an error-category privilege failure; [`01000`](../01000/) is the warning class.

## Sources {#sources}

- [`errcodes.txt`](https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/utils/errcodes.txt#L89) — definition, SHA-256 `6e8de346643ba84aa3c9c6a73360acfc7b2dfb89162c06c08ce9bf5bcd5bbcba`.
- [`aclchk.c`](https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/catalog/aclchk.c#L318-L382) — fixed path, SHA-256 `9700258318959b47c42edb423418fb511dd3a008023e732f601eecf4c80868f8`.
- [Structured evidence](../data/evidence/01006.json) — fixed sources, message groups, and runtime boundary.
