2201F — invalid_argument_for_power_function
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.
English manual coverage begins with PostgreSQL 8.1. Source history and runtime observations have their own recorded version boundaries.
Reading PG 18·Select a recorded version
- aliases
- Unknown
- class name
- Data Exception
- condition name
- invalid_argument_for_power_function
- lang
- en
- sqlstate
- 2201F
Definition PG 18
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.
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}
Sources {#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.
Compare versions
SQLSTATE evidence and recorded runtime versions
claims · identity
{
"claim_id": "identity",
"limits": "",
"method": "Read the fixed errcodes row and macro.",
"position": 0,
"runtime": [],
"sources": [
"src.errcodes.18.6"
],
"statement": "2201F is invalid_argument_for_power_function in SQLSTATE Class 22"
}claims · resolved-path
{
"claim_id": "resolved-path",
"limits": "Source confirmation is not a natural runtime observation.",
"method": "Read complete source contexts for the representative guards.",
"position": 1,
"runtime": [],
"sources": [
"src.numeric.power.special",
"src.numeric.power.finite",
"src.numeric.power.negative"
],
"statement": "Fixed PostgreSQL 18.6 numeric power paths bind zero-negative-exponent and negative-base-non-integral guards, including finite and special-value branches."
}claims · history
{
"claim_id": "history",
"limits": "",
"method": "Use catalogue presence and history boundaries.",
"position": 2,
"runtime": [],
"sources": [
"src.errcodes.18.6"
],
"statement": "The locked catalogue records 2201F from 8.0.0 without proving an exact implementation introduction date."
}messages · message.zero-negative-power
{
"limits": "",
"message_id": "message.zero-negative-power",
"path": "",
"position": 0,
"raw": {
"id": "message.zero-negative-power",
"primary_template": "zero raised to a negative power is undefined",
"severity_source": "ERROR",
"sources": [
"src.numeric.power.special",
"src.numeric.power.finite"
],
"sqlstate": "2201F"
},
"severity": "ERROR",
"sources": [
"src.numeric.power.special",
"src.numeric.power.finite"
],
"templates": [
{
"kind": "primary",
"literal": "zero raised to a negative power is undefined",
"position": 0,
"role": "",
"template": "zero raised to a negative power is undefined"
}
]
}messages · message.negative-noninteger
{
"limits": "",
"message_id": "message.negative-noninteger",
"path": "",
"position": 1,
"raw": {
"id": "message.negative-noninteger",
"primary_template": "a negative number raised to a non-integer power yields a complex result",
"severity_source": "ERROR",
"sources": [
"src.numeric.power.special",
"src.numeric.power.negative"
],
"sqlstate": "2201F"
},
"severity": "ERROR",
"sources": [
"src.numeric.power.special",
"src.numeric.power.negative"
],
"templates": [
{
"kind": "primary",
"literal": "a negative number raised to a non-integer power yields a complex result",
"position": 0,
"role": "",
"template": "a negative number raised to a non-integer power yields a complex result"
}
]
}sources · src.errcodes.18.6
{
"commit": "724edf9bde9d356724ad384a2e196edc3c9f80f7",
"docs_url": "",
"kind": "upstream_source",
"location": "",
"path": "src/backend/utils/errcodes.txt",
"position": 0,
"sha256": "6e8de346643ba84aa3c9c6a73360acfc7b2dfb89162c06c08ce9bf5bcd5bbcba",
"source_id": "src.errcodes.18.6",
"tag": "REL_18_6",
"url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/utils/errcodes.txt#L176"
}sources · src.numeric.power.special
{
"commit": "724edf9bde9d356724ad384a2e196edc3c9f80f7",
"docs_url": "",
"kind": "upstream_source",
"location": "",
"path": "src/backend/utils/adt/numeric.c",
"position": 1,
"sha256": "6cde7cd60b3330b83be35d1f014045f5fb5fe737f3c5db4c8ed4080b99f2b666",
"source_id": "src.numeric.power.special",
"tag": "REL_18_6",
"url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/utils/adt/numeric.c#L4045"
}sources · src.numeric.power.finite
{
"commit": "724edf9bde9d356724ad384a2e196edc3c9f80f7",
"docs_url": "",
"kind": "upstream_source",
"location": "",
"path": "src/backend/utils/adt/numeric.c",
"position": 2,
"sha256": "6cde7cd60b3330b83be35d1f014045f5fb5fe737f3c5db4c8ed4080b99f2b666",
"source_id": "src.numeric.power.finite",
"tag": "REL_18_6",
"url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/utils/adt/numeric.c#L4208"
}sources · src.numeric.power.negative
{
"commit": "724edf9bde9d356724ad384a2e196edc3c9f80f7",
"docs_url": "",
"kind": "upstream_source",
"location": "",
"path": "src/backend/utils/adt/numeric.c",
"position": 3,
"sha256": "6cde7cd60b3330b83be35d1f014045f5fb5fe737f3c5db4c8ed4080b99f2b666",
"source_id": "src.numeric.power.negative",
"tag": "REL_18_6",
"url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/utils/adt/numeric.c#L11373"
}Source references
Full definition and evidence JSON
Definition sources
center · PostgreSQL 18 · english-manuals:bf55f545f859f0e96010b2a8a1683bf09f2b9a84c9955e3bf2b27eab73499c23
Text language: en · english-manuals:bf55f545f859f0e96010b2a8a1683bf09f2b9a84c9955e3bf2b27eab73499c23