SQLSTATE 54023Severity lowLab verified

Incident brief

Too many function arguments

A function was called with more positional arguments than PostgreSQL allows in a single call. PostgreSQL rejected the call at parse time.

What lands in your log

ERROR: cannot pass more than 100 arguments to a function

Reproduced on PostgreSQL 16.14Verified 2026-07-16 (Docker lab, PostgreSQL 16.14)Verified against PostgreSQL 16.14 in an isolated lab environment

In 10 seconds

What triggers it
Call a variadic function (e.g. num_nonnulls()) with 101 plain positional arguments.
Fix
Pass the values inside a single VARIADIC array argument instead of as separate positional arguments, the array only counts as one argument no matter how many elements it holds.
Proof
Reproduced on PostgreSQL 16.14 → num_nonnulls() called with 101 plain positional arguments was rejected with SQLSTATE 54023, one past the 100-argument limit.

Fix

What to do right now

Application-level steps for this error.

  • Pass the values inside a single VARIADIC array argument instead of as separate positional arguments, the array only counts as one argument no matter how many elements it holds.
  • Don't just drop an argument to get back under the limit, see the premium counterexample for how that can silently change the answer.
Fix SQL
-- Prefer one VARIADIC/array argument over a huge positional list.
SELECT num_nonnulls(VARIADIC ARRAY[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149]::int[]);

Verification

PG 16.14
Last verified
2026-07-16 (Docker lab, PostgreSQL 16.14)
Verification scope
Verified against PostgreSQL 16.14 in an isolated lab environment
Audit status
reviewed
ShareLinkedInX

Went further?

Pro unlocks the second lab proof

Free page stops the bleeding. Pro adds the operational test, SQLSTATE audit, and deeper evidence, same error, more certainty.

FollowSubstackLinkedInnew errors · lab notes · hiring loops