select open change scope Open full search

PG.CENTER connects PostgreSQL documentation, reference, and ecosystem knowledge. Maintained by Pigsty.

SQLSTATE / CLASS 54 · PROGRAM LIMIT EXCEEDED

too_many_arguments

SQLSTATE
54023
Condition name
too_many_arguments
Class
Program Limit Exceeded
Source macro
ERRCODE_TOO_MANY_ARGUMENTS
Evidence
Source path confirmed
Analysis & operational context

English SQLSTATE atlas: authored explanations and source/runtime evidence are separate from the manual definitions. View source ↗

<h1>54023</h1>

At a glance

54023 is the argument-count limit for functions, procedures, aggregates, and set-returning calls. Fixed paths protect catalog arrays, parser nodes, and executor FunctionCallInfo storage, and report the actual compile-time limit with plural-aware messages.

Meaning

The fixed build defines FUNC_MAX_ARGS as 100 in pg_config_manual.h; the source notes a practical upper bound near 600 and requires a full backend (including C functions) recompile if it changes. Function definitions count input parameters and explicitly do not count output arguments. Aggregate definitions and aggregate calls use FUNC_MAX_ARGS - 1 so transition/final functions remain representable. Procedure/function parser and executor guards cover explicit arguments plus default arguments, SRFs, and stored window expressions. The caller and object kind determine the repair.

Messages

Source path Exact primary template (singular / plural) Count passed to %d
pg_proc.c function definition functions cannot have more than %d argument / functions cannot have more than %d arguments Compare parameterCount (the input-parameter array length; output parameters are excluded) with FUNC_MAX_ARGS; %d receives FUNC_MAX_ARGS (100)
functioncmds.c procedure call cannot pass more than %d argument to a procedure / cannot pass more than %d arguments to a procedure Compare nargs = list_length(fexpr->args) with FUNC_MAX_ARGS; %d receives FUNC_MAX_ARGS
parse_func.c, execExpr.c, execSRF.c, and nodeWindowAgg.c function/SRF/window call cannot pass more than %d argument to a function / cannot pass more than %d arguments to a function Compare list_length(fargs), nargs, list_length(sexpr->args), or perfuncstate->numArguments with FUNC_MAX_ARGS; %d receives FUNC_MAX_ARGS
pg_aggregate.c aggregate definition/call aggregates cannot have more than %d argument / aggregates cannot have more than %d arguments Compare numArgs with FUNC_MAX_ARGS - 1; %d receives 99, leaving a slot for transition/final functions

These are errmsg_plural groups, so clients should preserve the server's singular/plural rendering and the reported limit instead of searching only for one hand-written string.

Diagnosis

Record whether the failure is CREATE/definition time or invocation time, and whether the object is a function, procedure, aggregate, SRF, or window aggregate. Count explicit arguments and parser-expanded defaults; for an aggregate use the stricter FUNC_MAX_ARGS - 1 boundary. Preserve the exact singular/plural primary and maximum from the message, and check whether a stored view/plan was made by a binary with a different FUNC_MAX_ARGS.

Response

Reduce the argument list, group related values into a composite or documented record type, or redesign the function boundary. For a procedure or aggregate definition, change the signature and dependent callers together; do not silently drop arguments, count output arguments as inputs, or assume aggregate and ordinary-function calls share the same limit. Changing FUNC_MAX_ARGS is a build-wide compatibility decision, not a session setting. If an ERROR occurs inside an explicit transaction, use ROLLBACK or ROLLBACK TO SAVEPOINT before retrying; in autocommit, retry only after the definition or call has been changed to fit the fixed count.

Versions

The locked catalogue records this condition from 7.4; cited macro, catalog, parser, executor, aggregate, and SRF paths are PostgreSQL 18.6 source. No oversized signature or call was created.

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

The structured evidence record records fixed messages and the source/runtime boundary.

Source evidence

Evidence belongs to the frozen source and runtime versions listed here. It is not a runtime verification of the selected manual version.

54023 is too_many_arguments in SQLSTATE Class 54.

Method: Read fixed definition.

src.errcodes.18.6

The cited PostgreSQL 18.6 source paths support the representative resource and object-state mechanisms described.

Method: Read complete fixed source contexts.

Limits: Source confirmation is not natural runtime.

src.path.0 src.path.1 src.path.2 src.path.3 src.path.4 src.path.5 src.path.6 src.path.7

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.

Method: Read the fixed macro, aggregate, parser, and executor guards.

src.path.4 src.path.5 src.path.6 src.path.7

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.

Method: Read source-call report groups alongside complete fixed files.

src.calls.REL_18_6

The locked catalogue records 54023 from 7.4; that boundary does not prove exact implementation introduction.

Method: Use catalogue boundary.

src.errcodes.18.6

Message templates

ERROR · message.0

Primary

functions cannot have more than %d argument

Primary

functions cannot have more than %d arguments
ERROR · message.1

Primary

cannot pass more than %d argument to a procedure

Primary

cannot pass more than %d arguments to a procedure
ERROR · message.2

Primary

cannot pass more than %d argument to a function

Primary

cannot pass more than %d arguments to a function
ERROR · message.3

Primary

cannot pass more than %d argument to a function

Primary

cannot pass more than %d arguments to a function
ERROR · message.4

Primary

aggregates cannot have more than %d argument

Primary

aggregates cannot have more than %d arguments
ERROR · message.5

Primary

cannot pass more than %d argument to a function

Primary

cannot pass more than %d arguments to a function

Reproduction & repair cases

No reproduction case is attached to this condition.

Recorded runtime evidence

No runtime observation is attached to this entry.

Definition snapshot: english-manuals:b5656bf070f76b98bb2214bd05a… · English manual source