选择 打开 改范围 完整检索页

pgsql.cc 提供对 postgresql.org 官网内容的中文翻译,由 Pigsty 团队维护。

百科 / 错误代码 / Class 01 警告

01007 privilege_not_granted

WARNING 源码确认 参考 未实测

类别
Class 01 警告
严重等级
WARNING
条件名
privilege_not_granted
宏名称
ERRCODE_WARNING_PRIVILEGE_NOT_GRANTED
启用版本
8.0
状态
活跃

版本覆盖

速览

PostgreSQL 18.6 在 src/backend/catalog/aclchk.cGRANT 路径确认发出 01007。它报告授予为空或不完整,本身不表示 GRANT 以 error 失败。

含义

确认的 18.6 实现是 ACL 命令中的 GRANT 路径,区分没有授予权限和没有完全授予权限,并分别使用列级和对象级模板。

消息与诊断

18.6 固定路径的主消息模板为:no privileges were granted for column "%s" of relation "%s"no privileges were granted for "%s"not all privileges were granted for column "%s" of relation "%s"not all privileges were granted for "%s"。确认组没有 detail 或 hint。

报文模板

源码里的格式串,不是某一次运行的输出。%s 之类是占位符,实际报文会填入对象名与取值。适用范围一栏是核验时留下的原始英文记录,未经翻译。

主消息 no privileges were granted for column "%s" of relation "%s"

来源:src/backend/catalog/aclchk.c @ REL_18_6

主消息 no privileges were granted for "%s"

来源:src/backend/catalog/aclchk.c @ REL_18_6

主消息 not all privileges were granted for column "%s" of relation "%s"

来源:src/backend/catalog/aclchk.c @ REL_18_6

主消息 not all privileges were granted for "%s"

来源:src/backend/catalog/aclchk.c @ REL_18_6

诊断

记录目标是列还是对象,以及确切关系/对象名。在固定 aclchk.c 函数中,this_privileges 是请求权限集合与有效 grantor 可用 grant option 的交集。GRANT warning 在该掩码为零时是 none,在 !all_privs 且掩码不同于请求时是 partial;这个 warning 分支不会检查 grantee 的旧 ACL。分别检查有效授权者、grant option、请求权限,再检查最终 ACL。区分部分 WARNING 与权限 ERROR

处理

检查 ACL 结果,并修正操作涉及的角色、目标、权限或授予选项。只有在理解权限不匹配后,重新执行相同 GRANT 才有意义。

版本

01007 在锁定目录 9.0.23 至 18.6 以及 19 Beta 3 中存在,known_present_by 为 8.0.0。18.6 路径确认当前消息和严重级别,不表示历史措辞一致。

来源

证据

断言

每条断言都写明了是怎么核实的,以及它不覆盖什么。这一层是核验时留下的原始英文记录,照原样呈现,未经翻译。

  • 01007 is privilege_not_granted in SQLSTATE Class 01.

    核实方式Read the fixed errcodes definition row and macro.

    来源src/backend/utils/errcodes.txt

  • A fixed PostgreSQL 18.6 source path uses this SQLSTATE at the stated severity and operation.

    核实方式Read the fixed source context around the SQLSTATE macro.

    不覆盖This confirms a source path and current wording; it is not a runtime observation of every installation.

    来源src/backend/catalog/aclchk.c

  • The fixed aclchk.c function computes this_privileges as the requested privilege set intersected with the effective grantor's available grant options. The GRANT none branch warns when that mask is zero; the partial branch warns when !all_privs and the mask differs from the request. This warning branch does not inspect the grantee's old ACL; the resulting ACL must be checked separately.

    核实方式Read restrict_and_check_grant() and its fixed {op} report branches around aclchk.c lines 318-382.

    不覆盖This is a source-level warning condition; it does not claim a natural runtime or prescribe a universal role/ACL setup.

    来源src/backend/catalog/aclchk.c

同类错误代码

Class 01 警告 下的其他成员。