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

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

Wiki / SQLSTATE

54000 \u2014 program_limit_exceeded

超出程序固定上限,如数组维度或分配大小。

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

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

aliases
未知
class name
Program Limit Exceeded
condition name
program_limit_exceeded
lang
en
sqlstate
54000

版本定义 PG 18

54000

速览 {#at-a-glance}

54000 用于超过具体程序、表示或扩展上限。固定例子包括安全分配大小算术、关系 block 编号、数组维度/大小、cube 维度和 hstore pair 数,具体限制由源码路径决定。

含义 {#meaning}

它不是泛化的“大值”警告:核心 mcxt.c 检查分配大小的加法和乘法,溢出时报 invalid memory allocation request size ...;关系存储拒绝 InvalidBlockNumber 对应的 block;数组构造/下标路径分别检查维度和总大小。扩展还定义自己的上限:cube 报维度不能超过 %d,hstore 报实际与最大 pair 数。限制取决于操作和源码路径。

诊断 {#diagnosis}

确认源码组件以及实际值/上限,判断是分配大小溢出、关系增长、数组维度/大小、cube 维度、hstore pair 还是其他组件。检查会扩张请求的表达式或生成值;分配大小溢出是请求算术问题,不能据此断言主机 RAM 已耗尽。

处理 {#response}

降低请求大小、维度、block 增长或 pair 数,拆分值,或选择符合文档上限的表示;关系达到限制时先重设计或分区存储。显式事务中若发生 ERROR,重试前执行 ROLLBACK 或 ROLLBACK TO SAVEPOINT;自动提交只有在请求符合指定程序上限后才能重试。不要静默丢弃元素,也不要盲目提高无关内存参数来掩盖算术溢出。

版本 {#versions}

锁定目录从 7.4 记录;引用核心和扩展路径来自 PostgreSQL 18.6,未强制触发限制,也未创建超大扩展值。

相关 {#related}

54011、54023、22000

来源 {#sources}

contrib/cube/cube.c#L162-L166

contrib/hstore/hstore_io.c#L522-L525

src/backend/utils/mmgr/mcxt.c#L1683-L1718

src/backend/storage/smgr/md.c#L493-L504

src/backend/utils/adt/arraysubs.c#L147-L152

结构化证据记录保存固定消息以及源码/运行边界。

比较版本

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

claims · identity
{
  "claim_id": "identity",
  "limits": "",
  "method": "Read fixed definition.",
  "position": 0,
  "runtime": [],
  "sources": [
    "src.errcodes.18.6"
  ],
  "statement": "54000 is program_limit_exceeded in SQLSTATE Class 54."
}
claims · resolved-paths
{
  "claim_id": "resolved-paths",
  "limits": "Source confirmation is not natural runtime.",
  "method": "Read complete fixed source contexts.",
  "position": 1,
  "runtime": [],
  "sources": [
    "src.path.0",
    "src.path.1",
    "src.path.2",
    "src.path.3",
    "src.path.4"
  ],
  "statement": "The cited PostgreSQL 18.6 source paths support the representative resource and object-state mechanisms described."
}
claims · core-limit-mechanisms
{
  "claim_id": "core-limit-mechanisms",
  "limits": "",
  "method": "Read complete fixed guards and their ereport groups.",
  "position": 2,
  "runtime": [],
  "sources": [
    "src.path.2",
    "src.path.3",
    "src.path.4"
  ],
  "statement": "Core safe allocation-size arithmetic, relation block growth, and array subscript dimensions use 54000 independently of cube and hstore extension limits."
}
claims · history
{
  "claim_id": "history",
  "limits": "",
  "method": "Use catalogue boundary.",
  "position": 3,
  "runtime": [],
  "sources": [
    "src.errcodes.18.6"
  ],
  "statement": "The locked catalogue records 54000 from 7.4; that boundary does not prove exact implementation introduction."
}
messages · message.0
{
  "limits": "",
  "message_id": "message.0",
  "path": "",
  "position": 0,
  "raw": {
    "hint_template": "A cube cannot have more than %d dimensions.",
    "id": "message.0",
    "primary_template": "cube dimension limit",
    "severity_source": "ERROR",
    "sources": [
      "src.path.0"
    ],
    "sqlstate": "54000"
  },
  "severity": "ERROR",
  "sources": [
    "src.path.0"
  ],
  "templates": [
    {
      "kind": "primary",
      "literal": "cube dimension limit",
      "position": 0,
      "role": "",
      "template": "cube dimension limit"
    },
    {
      "kind": "hint",
      "literal": "A cube cannot have more than dimensions.",
      "position": 1,
      "role": "",
      "template": "A cube cannot have more than %d dimensions."
    }
  ]
}
messages · message.1
{
  "limits": "",
  "message_id": "message.1",
  "path": "",
  "position": 1,
  "raw": {
    "id": "message.1",
    "primary_template": "number of pairs (%d) exceeds the maximum allowed (%d)",
    "severity_source": "ERROR",
    "sources": [
      "src.path.1"
    ],
    "sqlstate": "54000"
  },
  "severity": "ERROR",
  "sources": [
    "src.path.1"
  ],
  "templates": [
    {
      "kind": "primary",
      "literal": "number of pairs ( ) exceeds the maximum allowed ( )",
      "position": 0,
      "role": "",
      "template": "number of pairs (%d) exceeds the maximum allowed (%d)"
    }
  ]
}
messages · message.2
{
  "limits": "",
  "message_id": "message.2",
  "path": "",
  "position": 2,
  "raw": {
    "id": "message.2",
    "primary_template": "invalid memory allocation request size %zu + %zu",
    "severity_source": "ERROR",
    "sources": [
      "src.path.2"
    ],
    "sqlstate": "54000"
  },
  "severity": "ERROR",
  "sources": [
    "src.path.2"
  ],
  "templates": [
    {
      "kind": "primary",
      "literal": "invalid memory allocation request size u + u",
      "position": 0,
      "role": "",
      "template": "invalid memory allocation request size %zu + %zu"
    }
  ]
}
messages · message.3
{
  "limits": "",
  "message_id": "message.3",
  "path": "",
  "position": 3,
  "raw": {
    "id": "message.3",
    "primary_template": "cannot extend file \"%s\" beyond %u blocks",
    "severity_source": "ERROR",
    "sources": [
      "src.path.3"
    ],
    "sqlstate": "54000"
  },
  "severity": "ERROR",
  "sources": [
    "src.path.3"
  ],
  "templates": [
    {
      "kind": "primary",
      "literal": "cannot extend file \" \" beyond blocks",
      "position": 0,
      "role": "",
      "template": "cannot extend file \"%s\" beyond %u blocks"
    }
  ]
}
messages · message.4
{
  "limits": "",
  "message_id": "message.4",
  "path": "",
  "position": 4,
  "raw": {
    "id": "message.4",
    "primary_template": "number of array dimensions (%d) exceeds the maximum allowed (%d)",
    "severity_source": "ERROR",
    "sources": [
      "src.path.4"
    ],
    "sqlstate": "54000"
  },
  "severity": "ERROR",
  "sources": [
    "src.path.4"
  ],
  "templates": [
    {
      "kind": "primary",
      "literal": "number of array dimensions ( ) exceeds the maximum allowed ( )",
      "position": 0,
      "role": "",
      "template": "number of array dimensions (%d) exceeds the maximum allowed (%d)"
    }
  ]
}
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#L416"
}
sources · src.path.0
{
  "commit": "724edf9bde9d356724ad384a2e196edc3c9f80f7",
  "docs_url": "",
  "kind": "upstream_source",
  "location": "",
  "path": "contrib/cube/cube.c",
  "position": 1,
  "sha256": "6094de3208056ddc0a9756ed63a9b9d776be81e555d8240e69c864d7f0e6a9d2",
  "source_id": "src.path.0",
  "tag": "REL_18_6",
  "url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/contrib/cube/cube.c#L162"
}
sources · src.path.1
{
  "commit": "724edf9bde9d356724ad384a2e196edc3c9f80f7",
  "docs_url": "",
  "kind": "upstream_source",
  "location": "",
  "path": "contrib/hstore/hstore_io.c",
  "position": 2,
  "sha256": "4f9e853ca79e1412d989e937749eeb2a251f7e8173d2732098e4c8a67a96b3d4",
  "source_id": "src.path.1",
  "tag": "REL_18_6",
  "url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/contrib/hstore/hstore_io.c#L522"
}
sources · src.path.2
{
  "commit": "724edf9bde9d356724ad384a2e196edc3c9f80f7",
  "docs_url": "",
  "kind": "upstream_source",
  "location": "",
  "path": "src/backend/utils/mmgr/mcxt.c",
  "position": 3,
  "sha256": "19824d40a1b2b7f533fd7863c91117a33c0879bf776fc7fbe495f603e032344e",
  "source_id": "src.path.2",
  "tag": "REL_18_6",
  "url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/utils/mmgr/mcxt.c#L1683"
}
sources · src.path.3
{
  "commit": "724edf9bde9d356724ad384a2e196edc3c9f80f7",
  "docs_url": "",
  "kind": "upstream_source",
  "location": "",
  "path": "src/backend/storage/smgr/md.c",
  "position": 4,
  "sha256": "c7e885c50b381337b8b8624bfc8effbd3abba7aa95a290083996354926ec9f69",
  "source_id": "src.path.3",
  "tag": "REL_18_6",
  "url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/storage/smgr/md.c#L493"
}
sources · src.path.4
{
  "commit": "724edf9bde9d356724ad384a2e196edc3c9f80f7",
  "docs_url": "",
  "kind": "upstream_source",
  "location": "",
  "path": "src/backend/utils/adt/arraysubs.c",
  "position": 5,
  "sha256": "59b00fb9b770f84eb97948e1e2dd339b25f4fbc331fdf972d0f1b13fd2a7e4ad",
  "source_id": "src.path.4",
  "tag": "REL_18_6",
  "url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/utils/adt/arraysubs.c#L147"
}

来源引用

完整定义与证据 JSON

定义来源

center · PostgreSQL 18 · english-manuals:70dfa1a89637e901709265b7b0824f3065991d2c1b2978122b5e8b7f65f19f23

正文语言: zh-Hans · english-manuals:70dfa1a89637e901709265b7b0824f3065991d2c1b2978122b5e8b7f65f19f23