2201F — invalid_argument_for_power_function
2201F
At a glance
Power functions reject operands whose real-valued result is undefined. Fixed numeric paths report zero raised to a negative power is undefined or a negative number raised to a non-integer power yields a complex result.
| Field | Value |
|---|---|
| SQLSTATE | 2201F |
| Condition | invalid_argument_for_power_function |
| Status | active |
| Known present by | 8.0.0 |
| Locked snapshots | 9.0.23, 9.1.24, 9.2.24, 9.3.25, 9.4.26, 9.5.25, 9.6.24, 10.23, 11.22, 12.22, 13.23, 14.24, 15.19, 16.15, 17.11, 18.6, 19beta3 |
| Macros | ERRCODE_INVALID_ARGUMENT_FOR_POWER_FUNCTION |
| Aliases | — |
Meaning
2201F covers two distinct power guards: a zero base with a negative exponent, and a negative base with a non-integer exponent. The checks occur for ordinary finite numeric values and in the special-value path. Numeric NaN handling can return NaN or 1 under POSIX rules, and several infinity combinations are defined; a negative base with an integer exponent is not automatically this error.
Diagnosis
Inspect the resolved base and exponent types and the exact primary message. A decimal exponent that is not integral is different from a negative integer exponent, so changing scale or applying an unrelated cast is not a repair. Check special values separately rather than treating every NaN or infinity as an invalid power.
Response
Choose a base/exponent pair with the intended real result, or change the business rule explicitly. If the ERROR is in an explicit transaction, roll back or roll back to the existing savepoint before retrying; an autocommit client can retry the corrected operation.
Versions
The locked catalogue records this condition from 8.0.0; the fixed source paths here are PostgreSQL 18.6. No natural runtime observation is claimed for this page.
Related
Sources
The finite and special-value guards are in src/backend/utils/adt/numeric.c#L4045-4111 and #L4208-4220; the negative-base non-integral guard is in #L11373-11384. The structured evidence record retains the exact message roles; no natural runtime was run.