↑↓ 选择↵ 打开⌫ 切换范围完整搜索

PG.CENTER 连接 PostgreSQL 文档、百科与生态知识。由 Pigsty 维护。

Wiki / SQLSTATE

01007 — privilege_not_granted

GRANT 未授予或未完全授予权限的警告。

英文手册覆盖始于 PostgreSQL 8.1. 来源历史与运行验证各自保留独立版本边界。

当前阅读 PG 18·选择有来源记录的版本

aliases
未知
class name
Warning
condition name
privilege_not_granted
lang
en
sqlstate
01007

版本定义 PG 18

01007 — privilege_not_granted

速览 {#at-a-glance}

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

含义 {#meaning}

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

消息与诊断 {#messages}

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。

诊断 {#diagnosis}

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

处理 {#response}

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

版本 {#versions}

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

相关 {#related}

01006 是未撤销权限 warning;42501 是权限 error;01000 是警告类。

来源 {#sources}

  • errcodes.txt — 定义,SHA-256 6e8de346643ba84aa3c9c6a73360acfc7b2dfb89162c06c08ce9bf5bcd5bbcba.
  • aclchk.c — 固定路径,SHA-256 9700258318959b47c42edb423418fb511dd3a008023e732f601eecf4c80868f8。
  • 结构化证据 — 固定来源、消息和运行边界。

比较版本

SQLSTATE 证据与已记录的运行版本

claims · identity
{
  "claim_id": "identity",
  "limits": "",
  "method": "Read the fixed errcodes definition row and macro.",
  "position": 0,
  "runtime": [],
  "sources": [
    "src.errcodes.18.6"
  ],
  "statement": "01007 is privilege_not_granted in SQLSTATE Class 01."
}
claims · source-path
{
  "claim_id": "source-path",
  "limits": "This confirms a source path and current wording; it is not a runtime observation of every installation.",
  "method": "Read the fixed source context around the SQLSTATE macro.",
  "position": 1,
  "runtime": [],
  "sources": [
    "src.aclchk.18.6"
  ],
  "statement": "A fixed PostgreSQL 18.6 source path uses this SQLSTATE at the stated severity and operation."
}
claims · acl-effective-grantor
{
  "claim_id": "acl-effective-grantor",
  "limits": "This is a source-level warning condition; it does not claim a natural runtime or prescribe a universal role/ACL setup.",
  "method": "Read restrict_and_check_grant() and its fixed {op} report branches around aclchk.c lines 318-382.",
  "position": 2,
  "runtime": [],
  "sources": [
    "src.aclchk.18.6"
  ],
  "statement": "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."
}
messages · acl-grant-column-none
{
  "limits": "",
  "message_id": "acl-grant-column-none",
  "path": "src.aclchk.18.6",
  "position": 0,
  "raw": {
    "id": "acl-grant-column-none",
    "path": "src.aclchk.18.6",
    "primary_template": "no privileges were granted for column \"%s\" of relation \"%s\"",
    "severity": "WARNING",
    "source_ids": [
      "src.aclchk.18.6"
    ],
    "sources": [
      "src.aclchk.18.6"
    ],
    "sqlstate": "01007"
  },
  "severity": "WARNING",
  "sources": [
    "src.aclchk.18.6"
  ],
  "templates": [
    {
      "kind": "primary",
      "literal": "no privileges were granted for column \" \" of relation \" \"",
      "position": 0,
      "role": "",
      "template": "no privileges were granted for column \"%s\" of relation \"%s\""
    }
  ]
}
messages · acl-grant-object-none
{
  "limits": "",
  "message_id": "acl-grant-object-none",
  "path": "src.aclchk.18.6",
  "position": 1,
  "raw": {
    "id": "acl-grant-object-none",
    "path": "src.aclchk.18.6",
    "primary_template": "no privileges were granted for \"%s\"",
    "severity": "WARNING",
    "source_ids": [
      "src.aclchk.18.6"
    ],
    "sources": [
      "src.aclchk.18.6"
    ],
    "sqlstate": "01007"
  },
  "severity": "WARNING",
  "sources": [
    "src.aclchk.18.6"
  ],
  "templates": [
    {
      "kind": "primary",
      "literal": "no privileges were granted for \" \"",
      "position": 0,
      "role": "",
      "template": "no privileges were granted for \"%s\""
    }
  ]
}
messages · acl-grant-column-partial
{
  "limits": "",
  "message_id": "acl-grant-column-partial",
  "path": "src.aclchk.18.6",
  "position": 2,
  "raw": {
    "id": "acl-grant-column-partial",
    "path": "src.aclchk.18.6",
    "primary_template": "not all privileges were granted for column \"%s\" of relation \"%s\"",
    "severity": "WARNING",
    "source_ids": [
      "src.aclchk.18.6"
    ],
    "sources": [
      "src.aclchk.18.6"
    ],
    "sqlstate": "01007"
  },
  "severity": "WARNING",
  "sources": [
    "src.aclchk.18.6"
  ],
  "templates": [
    {
      "kind": "primary",
      "literal": "not all privileges were granted for column \" \" of relation \" \"",
      "position": 0,
      "role": "",
      "template": "not all privileges were granted for column \"%s\" of relation \"%s\""
    }
  ]
}
messages · acl-grant-object-partial
{
  "limits": "",
  "message_id": "acl-grant-object-partial",
  "path": "src.aclchk.18.6",
  "position": 3,
  "raw": {
    "id": "acl-grant-object-partial",
    "path": "src.aclchk.18.6",
    "primary_template": "not all privileges were granted for \"%s\"",
    "severity": "WARNING",
    "source_ids": [
      "src.aclchk.18.6"
    ],
    "sources": [
      "src.aclchk.18.6"
    ],
    "sqlstate": "01007"
  },
  "severity": "WARNING",
  "sources": [
    "src.aclchk.18.6"
  ],
  "templates": [
    {
      "kind": "primary",
      "literal": "not all privileges were granted for \" \"",
      "position": 0,
      "role": "",
      "template": "not all privileges were granted for \"%s\""
    }
  ]
}
sources · src.errcodes.18.6
{
  "commit": "724edf9bde9d356724ad384a2e196edc3c9f80f7",
  "docs_url": "",
  "kind": "upstream_source",
  "location": "",
  "path": "src/backend/utils/errcodes.txt",
  "position": 0,
  "sha256": "6e8de346643ba84aa3c9c6a73360acfc7b2dfb89162c06c08ce9bf5bcd5bbcba",
  "source_id": "src.errcodes.18.6",
  "tag": "REL_18_6",
  "url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/utils/errcodes.txt"
}
sources · src.aclchk.18.6
{
  "commit": "724edf9bde9d356724ad384a2e196edc3c9f80f7",
  "docs_url": "",
  "kind": "upstream_source",
  "location": "",
  "path": "src/backend/catalog/aclchk.c",
  "position": 1,
  "sha256": "9700258318959b47c42edb423418fb511dd3a008023e732f601eecf4c80868f8",
  "source_id": "src.aclchk.18.6",
  "tag": "REL_18_6",
  "url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/catalog/aclchk.c#L318-L382"
}
sources · src.calls.REL_18_6
{
  "commit": "",
  "docs_url": "",
  "kind": "local_artifact",
  "location": "",
  "path": "raw/calls/REL_18_6.jsonl",
  "position": 2,
  "sha256": "9ee8a0e81d8f0825c5c1ae45583439859a26e602bdd4ce2f2a62aa278867ccbf",
  "source_id": "src.calls.REL_18_6",
  "tag": "",
  "url": ""
}

来源引用

完整定义与证据 JSON

定义来源

center · PostgreSQL 18 · english-manuals:a5b2a7d51c00286e452ccd7f0f6bd2c055ecfe205ee0b287b2f1c19c0d433b44

正文语言: zh-Hans · english-manuals:a5b2a7d51c00286e452ccd7f0f6bd2c055ecfe205ee0b287b2f1c19c0d433b44