选择 打开 改范围 完整检索页

pgsql.cc 提供对 postgresql.org 官网内容的中文翻译,由 Pigsty 团队维护。

百科 / 错误代码 / Class 22 数据异常

2201G invalid_argument_for_width_bucket_function

ERROR 源码确认 参考 未实测

类别
Class 22 数据异常
严重等级
ERROR
条件名
invalid_argument_for_width_bucket_function
宏名称
ERRCODE_INVALID_ARGUMENT_FOR_WIDTH_BUCKET_FUNCTION
启用版本
8.0
状态
活跃

版本覆盖

速览

width_bucket 会校验 bucket 数、NaN 输入、直方图边界和边界相等情况。固定 numeric 与 float8 路径分别报告 count 非正、NaN、边界非有限和上下界相等这四类 2201G 报文。

代表性报文

固定守卫使用以下首要文本:

守卫 首要文本
非正 count count must be greater than zero
operand 或边界含 NaN operand, lower bound, and upper bound cannot be NaN
边界非有限 lower and upper bounds must be finite
边界相等 lower bound cannot equal upper bound

报文模板

源码里的格式串,不是某一次运行的输出。%s 之类是占位符,实际报文会填入对象名与取值。适用范围一栏是核验时留下的原始英文记录,未经翻译。

主消息 count must be greater than zero

来源:src/backend/utils/adt/numeric.c @ REL_18_6 · src/backend/utils/adt/float.c @ REL_18_6

主消息 operand, lower bound, and upper bound cannot be NaN

来源:src/backend/utils/adt/numeric.c @ REL_18_6 · src/backend/utils/adt/float.c @ REL_18_6

主消息 lower and upper bounds must be finite

来源:src/backend/utils/adt/numeric.c @ REL_18_6 · src/backend/utils/adt/float.c @ REL_18_6

主消息 lower bound cannot equal upper bound

来源:src/backend/utils/adt/numeric.c @ REL_18_6 · src/backend/utils/adt/float.c @ REL_18_6

含义

对于 numeric 和 float8 的 width_bucket(operand, bound1, bound2, count) 签名,count 必须大于零;operand 或任一边界不能是 NaN;两个边界都必须有限且不能相等。实现同时支持递增和递减边界,operand 为无穷值也允许,只有无穷边界被拒绝。合法端点计算若使 count + 1 溢出,源码报告的是另一个 22003。

诊断

按函数签名和确切首要报文定位参数。区分 count、NaN 与无穷值,并区分 operand 和两个边界。不要强行要求下界小于上界:递减边界有独立的合法计算路径;只有相等边界是本码明确拒绝的排序关系。

处理

在保留预期桶方向的前提下修正指定的 count、operand 或边界。使用正 count、有限且不相等的边界;若结果超出范围,应按独立的 22003 处理。如果 ERROR 发生在显式事务中,应先 ROLLBACK 或回滚到既有保存点再重试;自动提交可重试修正后的调用。

版本

锁定目录从 8.0.0 起记录该条件;本页固定源码路径为 PostgreSQL 18.6。未声称本页有自然运行观察。

来源

证据

断言

每条断言都写明了是怎么核实的,以及它不覆盖什么。这一层是核验时留下的原始英文记录,照原样呈现,未经翻译。

  • 2201G is invalid_argument_for_width_bucket_function in SQLSTATE Class 22

    核实方式Read the fixed errcodes row and macro.

    来源src/backend/utils/errcodes.txt

  • Fixed PostgreSQL 18.6 numeric and float8 width_bucket paths bind count, NaN, finite-bound, unequal-bound, ascending, descending, and operand-infinity behavior.

    核实方式Read complete source contexts for the representative guards.

    不覆盖Source confirmation is not a natural runtime observation.

    来源src/backend/utils/adt/numeric.c · src/backend/utils/adt/float.c

  • The locked catalogue records 2201G from 8.0.0 without proving an exact implementation introduction date.

    核实方式Use catalogue presence and history boundaries.

    来源src/backend/utils/errcodes.txt

  • Valid endpoint arithmetic can raise the distinct 22003 integer-out-of-range condition when count plus one exceeds int4.

    核实方式Read the result conversion/overflow branch, not the 2201G guards.

    来源src/backend/utils/adt/numeric.c · src/backend/utils/adt/float.c

同类错误代码

Class 22 数据异常 下的其他成员。