22022
PostgreSQLERRORCriticalData ExceptionHIGH confidence
indicator overflow
What this means
SQLSTATE 22022 is a standard SQL code raised when an indicator variable overflows. In Postgres this is uncommon in practice and mainly applies to embedded SQL (ECPG) contexts where indicator variables track NULL status and string lengths.
Why it happens
- 1In ECPG (embedded C SQL), an indicator variable is too small to hold the actual length of the retrieved string
How to reproduce
ECPG program retrieving a long string with an undersized indicator variable.
expected output
ERROR: indicator variable value is out of range
Fix
Use a larger indicator variable type in ECPG
WHEN When using embedded SQL (ECPG) with indicator variables.
Why this works
Declare the indicator variable as a long or ensure it can hold the maximum string length returned by the query.
Sources
Official documentation ↗
Class 22 — Data Exception
Content generated with AI assistance and reviewed for accuracy. Found an error? hello@errcodes.dev