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

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

Wiki / SQLSTATE

54023 \u2014 too_many_arguments

函数或过程的参数个数超过编译时上限。

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

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

aliases
未知
class name
Program Limit Exceeded
condition name
too_many_arguments
lang
en
sqlstate
54023

版本定义 PG 18

54023

速览 {#at-a-glance}

54023 是函数、过程、聚合和返回集合调用的参数数量上限。固定路径保护 catalog 数组、parser 节点和 executor FunctionCallInfo 存储,并按单复数报告编译时实际限制。

含义 {#meaning}

固定构建在 pg_config_manual.h 中把 FUNC_MAX_ARGS 定义为 100;源码说明实际可行上限约为 600,修改它需要完整重编 backend(包括 C 函数)。函数定义统计输入参数,明确不统计 output 参数。聚合定义和聚合调用使用 FUNC_MAX_ARGS - 1,为 transition/final function 保留可表示空间。函数/过程 parser 与 executor guard 还覆盖显式参数、默认参数、SRF 和保存的 window expression。调用者和对象类型决定修复。

报文 {#messages}

| 源码路径 | 精确 primary 模板(单数 / 复数) | %d 的计数上限 | | --- | --- | --- | | pg_proc.c 函数定义 | functions cannot have more than %d argument / functions cannot have more than %d arguments | 将 parameterCount(input 参数数组长度,不含 output 参数)与 FUNC_MAX_ARGS 比较;%d 传入 FUNC_MAX_ARGS(100) | | functioncmds.c 过程调用 | cannot pass more than %d argument to a procedure / cannot pass more than %d arguments to a procedure | 将 nargs = list_length(fexpr->args) 与 FUNC_MAX_ARGS 比较;%d 传入 FUNC_MAX_ARGS | | parse_func.c、execExpr.c、execSRF.c、nodeWindowAgg.c 函数/SRF/window 调用 | cannot pass more than %d argument to a function / cannot pass more than %d arguments to a function | 将 list_length(fargs)、nargs、list_length(sexpr->args) 或 perfuncstate->numArguments 与 FUNC_MAX_ARGS 比较;%d 传入 FUNC_MAX_ARGS | | pg_aggregate.c 聚合定义/调用 | aggregates cannot have more than %d argument / aggregates cannot have more than %d arguments | 将 numArgs 与 FUNC_MAX_ARGS - 1 比较;%d 传入 99,为 transition/final function 预留槽位 |

这些是 errmsg_plural 分组,客户端应保留服务器的单复数渲染和实际上限,不要只搜索一条手写字符串。

诊断 {#diagnosis}

先确认是在 CREATE/定义阶段还是调用阶段,以及对象是函数、过程、聚合、SRF 还是 window aggregate。统计显式参数和 parser 展开的默认参数;聚合使用更严格的 FUNC_MAX_ARGS - 1 边界。保留消息的单复数 primary 与上限,并检查 stored view/plan 是否由不同 FUNC_MAX_ARGS 的二进制建立。

处理 {#response}

减少参数,把相关值组合为复合/record 类型,或重设计函数边界。修改过程或聚合签名时同步依赖调用者;不要静默丢弃参数、把 output 参数当 input 计数,也不要假设聚合和普通函数共用同一上限。修改 FUNC_MAX_ARGS 是构建级兼容决策,不是会话参数。显式事务中若发生 ERROR,重试前执行 ROLLBACK 或 ROLLBACK TO SAVEPOINT;自动提交只有在定义或调用已改到固定计数以内后才能重试。

版本 {#versions}

锁定目录从 7.4 记录;引用 macro、catalog、parser、executor、aggregate 和 SRF 路径来自 PostgreSQL 18.6,未创建超大签名或调用。

相关 {#related}

54011、54000、42883

来源 {#sources}

src/backend/catalog/pg_proc.c#L156-L161

src/backend/commands/functioncmds.c#L2261-L2266

src/backend/executor/execExpr.c#L2727-L2732

src/backend/executor/execSRF.c#L716-L721

src/include/pg_config_manual.h#L31-L43

src/backend/catalog/pg_aggregate.c#L121-L132

src/backend/parser/parse_func.c#L129-L142

src/backend/executor/nodeWindowAgg.c#L1042-L1054

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

比较版本

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

claims · identity
{
  "claim_id": "identity",
  "limits": "",
  "method": "Read fixed definition.",
  "position": 0,
  "runtime": [],
  "sources": [
    "src.errcodes.18.6"
  ],
  "statement": "54023 is too_many_arguments 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",
    "src.path.5",
    "src.path.6",
    "src.path.7"
  ],
  "statement": "The cited PostgreSQL 18.6 source paths support the representative resource and object-state mechanisms described."
}
claims · compile-time-limit
{
  "claim_id": "compile-time-limit",
  "limits": "",
  "method": "Read the fixed macro, aggregate, parser, and executor guards.",
  "position": 2,
  "runtime": [],
  "sources": [
    "src.path.4",
    "src.path.5",
    "src.path.6",
    "src.path.7"
  ],
  "statement": "FUNC_MAX_ARGS is a compile-time constant of 100 in the fixed PG18.6 header; aggregate definitions/calls use one fewer argument, and parser/executor guards protect calls including stored expressions."
}
claims · raw-message-roles
{
  "claim_id": "raw-message-roles",
  "limits": "",
  "method": "Read source-call report groups alongside complete fixed files.",
  "position": 3,
  "runtime": [],
  "sources": [
    "src.calls.REL_18_6"
  ],
  "statement": "The fixed report groups use errmsg_plural with singular and plural format_raw strings and pass FUNC_MAX_ARGS (or FUNC_MAX_ARGS - 1 for aggregates); the scan preserves the macro call rather than only a flattened message."
}
claims · history
{
  "claim_id": "history",
  "limits": "",
  "method": "Use catalogue boundary.",
  "position": 4,
  "runtime": [],
  "sources": [
    "src.errcodes.18.6"
  ],
  "statement": "The locked catalogue records 54023 from 7.4; that boundary does not prove exact implementation introduction."
}
messages · message.0
{
  "limits": "",
  "message_id": "message.0",
  "path": "",
  "position": 0,
  "raw": {
    "id": "message.0",
    "primary_template_plural": "functions cannot have more than %d arguments",
    "primary_template_singular": "functions cannot have more than %d argument",
    "severity_source": "ERROR",
    "sources": [
      "src.path.0"
    ],
    "sqlstate": "54023",
    "template_type": "plural"
  },
  "severity": "ERROR",
  "sources": [
    "src.path.0"
  ],
  "templates": [
    {
      "kind": "primary",
      "literal": "functions cannot have more than argument",
      "position": 0,
      "role": "singular",
      "template": "functions cannot have more than %d argument"
    },
    {
      "kind": "primary",
      "literal": "functions cannot have more than arguments",
      "position": 1,
      "role": "plural",
      "template": "functions cannot have more than %d arguments"
    }
  ]
}
messages · message.1
{
  "limits": "",
  "message_id": "message.1",
  "path": "",
  "position": 1,
  "raw": {
    "id": "message.1",
    "primary_template_plural": "cannot pass more than %d arguments to a procedure",
    "primary_template_singular": "cannot pass more than %d argument to a procedure",
    "severity_source": "ERROR",
    "sources": [
      "src.path.1"
    ],
    "sqlstate": "54023",
    "template_type": "plural"
  },
  "severity": "ERROR",
  "sources": [
    "src.path.1"
  ],
  "templates": [
    {
      "kind": "primary",
      "literal": "cannot pass more than argument to a procedure",
      "position": 0,
      "role": "singular",
      "template": "cannot pass more than %d argument to a procedure"
    },
    {
      "kind": "primary",
      "literal": "cannot pass more than arguments to a procedure",
      "position": 1,
      "role": "plural",
      "template": "cannot pass more than %d arguments to a procedure"
    }
  ]
}
messages · message.2
{
  "limits": "",
  "message_id": "message.2",
  "path": "",
  "position": 2,
  "raw": {
    "id": "message.2",
    "primary_template_plural": "cannot pass more than %d arguments to a function",
    "primary_template_singular": "cannot pass more than %d argument to a function",
    "severity_source": "ERROR",
    "sources": [
      "src.path.2"
    ],
    "sqlstate": "54023",
    "template_type": "plural"
  },
  "severity": "ERROR",
  "sources": [
    "src.path.2"
  ],
  "templates": [
    {
      "kind": "primary",
      "literal": "cannot pass more than argument to a function",
      "position": 0,
      "role": "singular",
      "template": "cannot pass more than %d argument to a function"
    },
    {
      "kind": "primary",
      "literal": "cannot pass more than arguments to a function",
      "position": 1,
      "role": "plural",
      "template": "cannot pass more than %d arguments to a function"
    }
  ]
}
messages · message.3
{
  "limits": "",
  "message_id": "message.3",
  "path": "",
  "position": 3,
  "raw": {
    "id": "message.3",
    "primary_template_plural": "cannot pass more than %d arguments to a function",
    "primary_template_singular": "cannot pass more than %d argument to a function",
    "severity_source": "ERROR",
    "sources": [
      "src.path.3"
    ],
    "sqlstate": "54023",
    "template_type": "plural"
  },
  "severity": "ERROR",
  "sources": [
    "src.path.3"
  ],
  "templates": [
    {
      "kind": "primary",
      "literal": "cannot pass more than argument to a function",
      "position": 0,
      "role": "singular",
      "template": "cannot pass more than %d argument to a function"
    },
    {
      "kind": "primary",
      "literal": "cannot pass more than arguments to a function",
      "position": 1,
      "role": "plural",
      "template": "cannot pass more than %d arguments to a function"
    }
  ]
}
messages · message.4
{
  "limits": "",
  "message_id": "message.4",
  "path": "",
  "position": 4,
  "raw": {
    "id": "message.4",
    "primary_template_plural": "aggregates cannot have more than %d arguments",
    "primary_template_singular": "aggregates cannot have more than %d argument",
    "severity_source": "ERROR",
    "sources": [
      "src.path.5"
    ],
    "sqlstate": "54023",
    "template_type": "plural"
  },
  "severity": "ERROR",
  "sources": [
    "src.path.5"
  ],
  "templates": [
    {
      "kind": "primary",
      "literal": "aggregates cannot have more than argument",
      "position": 0,
      "role": "singular",
      "template": "aggregates cannot have more than %d argument"
    },
    {
      "kind": "primary",
      "literal": "aggregates cannot have more than arguments",
      "position": 1,
      "role": "plural",
      "template": "aggregates cannot have more than %d arguments"
    }
  ]
}
messages · message.5
{
  "limits": "",
  "message_id": "message.5",
  "path": "",
  "position": 5,
  "raw": {
    "id": "message.5",
    "primary_template_plural": "cannot pass more than %d arguments to a function",
    "primary_template_singular": "cannot pass more than %d argument to a function",
    "severity_source": "ERROR",
    "sources": [
      "src.path.7"
    ],
    "sqlstate": "54023",
    "template_type": "plural"
  },
  "severity": "ERROR",
  "sources": [
    "src.path.7"
  ],
  "templates": [
    {
      "kind": "primary",
      "literal": "cannot pass more than argument to a function",
      "position": 0,
      "role": "singular",
      "template": "cannot pass more than %d argument to a function"
    },
    {
      "kind": "primary",
      "literal": "cannot pass more than arguments to a function",
      "position": 1,
      "role": "plural",
      "template": "cannot pass more than %d arguments to a function"
    }
  ]
}
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#L419"
}
sources · src.path.0
{
  "commit": "724edf9bde9d356724ad384a2e196edc3c9f80f7",
  "docs_url": "",
  "kind": "upstream_source",
  "location": "",
  "path": "src/backend/catalog/pg_proc.c",
  "position": 1,
  "sha256": "77a883995e5fadf17fae68722043beb43115e685e8082b2b7256d92312528a5a",
  "source_id": "src.path.0",
  "tag": "REL_18_6",
  "url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/catalog/pg_proc.c#L156"
}
sources · src.path.1
{
  "commit": "724edf9bde9d356724ad384a2e196edc3c9f80f7",
  "docs_url": "",
  "kind": "upstream_source",
  "location": "",
  "path": "src/backend/commands/functioncmds.c",
  "position": 2,
  "sha256": "33de4dd569d9b8b93ca3efbba4b31726af79f2864110454a7d7cdf286b3647aa",
  "source_id": "src.path.1",
  "tag": "REL_18_6",
  "url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/commands/functioncmds.c#L2261"
}
sources · src.path.2
{
  "commit": "724edf9bde9d356724ad384a2e196edc3c9f80f7",
  "docs_url": "",
  "kind": "upstream_source",
  "location": "",
  "path": "src/backend/executor/execExpr.c",
  "position": 3,
  "sha256": "9bc3aa2562686b1860005137de9611e56ff6b41eaf9b3eefd9c3f058dc057431",
  "source_id": "src.path.2",
  "tag": "REL_18_6",
  "url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/executor/execExpr.c#L2727"
}
sources · src.path.3
{
  "commit": "724edf9bde9d356724ad384a2e196edc3c9f80f7",
  "docs_url": "",
  "kind": "upstream_source",
  "location": "",
  "path": "src/backend/executor/execSRF.c",
  "position": 4,
  "sha256": "5c6038cbcc254113a39119af636331063b11d75ad7757b027620d78ed1ecdf2a",
  "source_id": "src.path.3",
  "tag": "REL_18_6",
  "url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/executor/execSRF.c#L716"
}
sources · src.path.4
{
  "commit": "724edf9bde9d356724ad384a2e196edc3c9f80f7",
  "docs_url": "",
  "kind": "upstream_source",
  "location": "",
  "path": "src/include/pg_config_manual.h",
  "position": 5,
  "sha256": "3b513dda5408337ef7c31bca491844650b4ea2cdb1b688d6b99ab74ba3f06700",
  "source_id": "src.path.4",
  "tag": "REL_18_6",
  "url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/include/pg_config_manual.h#L31"
}
sources · src.path.5
{
  "commit": "724edf9bde9d356724ad384a2e196edc3c9f80f7",
  "docs_url": "",
  "kind": "upstream_source",
  "location": "",
  "path": "src/backend/catalog/pg_aggregate.c",
  "position": 6,
  "sha256": "75c08cdd82917e45647f7c523c9ad8fb49423c89f13e26754be1e37e4c6a49b4",
  "source_id": "src.path.5",
  "tag": "REL_18_6",
  "url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/catalog/pg_aggregate.c#L121"
}
sources · src.path.6
{
  "commit": "724edf9bde9d356724ad384a2e196edc3c9f80f7",
  "docs_url": "",
  "kind": "upstream_source",
  "location": "",
  "path": "src/backend/parser/parse_func.c",
  "position": 7,
  "sha256": "48314eab022297478ac4e49786afaff2621ab7b1d7b50e156668cf477961384f",
  "source_id": "src.path.6",
  "tag": "REL_18_6",
  "url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/parser/parse_func.c#L129"
}
sources · src.path.7
{
  "commit": "724edf9bde9d356724ad384a2e196edc3c9f80f7",
  "docs_url": "",
  "kind": "upstream_source",
  "location": "",
  "path": "src/backend/executor/nodeWindowAgg.c",
  "position": 8,
  "sha256": "c365e6750bc77a89562254903d099c3e5914e001d3aae418322ccffc1d535d17",
  "source_id": "src.path.7",
  "tag": "REL_18_6",
  "url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/executor/nodeWindowAgg.c#L1042"
}
sources · src.calls.REL_18_6
{
  "commit": "",
  "docs_url": "",
  "kind": "local_artifact",
  "location": "",
  "path": "raw/calls/REL_18_6.jsonl",
  "position": 9,
  "sha256": "9ee8a0e81d8f0825c5c1ae45583439859a26e602bdd4ce2f2a62aa278867ccbf",
  "source_id": "src.calls.REL_18_6",
  "tag": "REL_18_6",
  "url": ""
}

来源引用

完整定义与证据 JSON

定义来源

center · PostgreSQL 18 · english-manuals:e244919789a20729855242fb689e77d74f54a8535443b7ea929c03dd8bd8f6f0

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