# 2201F — invalid_argument_for_power_function

> Source-backed reference for PostgreSQL SQLSTATE 2201F.
---

# 2201F

## At a glance {#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`.

<!-- BEGIN SQLSTATE FACTS: generated by scripts/generate.py; do not edit -->

| 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 | `—` |

<!-- source facts: data/errcodes/2201F.json -->
<!-- END SQLSTATE FACTS -->

## Meaning {#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 {#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 {#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 {#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 {#related}
[`2201E`](../2201e/), [`22003`](../22003/)

## Sources {#sources}
The finite and special-value guards are in [`src/backend/utils/adt/numeric.c#L4045-4111`](https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/utils/adt/numeric.c#L4045) and [`#L4208-4220`](https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/utils/adt/numeric.c#L4208); the negative-base non-integral guard is in [`#L11373-11384`](https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/utils/adt/numeric.c#L11373). The structured [evidence record](../data/evidence/2201f.json) retains the exact message roles; no natural runtime was run.
