SQLSTATE 22015Severity lowLab verified

Incident brief

Interval field overflow

An INTERVAL literal whose field value exceeds the storage limits of the interval type raises this data exception; here a months value larger than a signed 32-bit integer overflowed.

What lands in your log

ERROR: interval field value out of range: "2147483648 months"

Reproduced on PostgreSQL 18.4Verified 2026-07-24 (isolated lab, PostgreSQL 18.4)Verified against PostgreSQL 18.4 in an isolated lab environment

In 10 seconds

What triggers it
Write an INTERVAL literal with a field value larger than the type can store (for example billions of months).
Fix
Use interval field values within range, the months field fits in a signed 32-bit integer.
Proof
Reproduced on PostgreSQL 18.4 → A single SELECT reproduces SQLSTATE 22015; the oversized months field is rejected while the literal is evaluated.

Fix

What to do right now

Application-level steps for this error.

  • Use interval field values within range, the months field fits in a signed 32-bit integer.
  • For very long spans, model them differently (a start date plus a smaller interval, or a numeric day count).
Fix SQL
-- Use an interval field value within the type's range.
SELECT INTERVAL '1 month';

Connected

Everything this error touches

Every page this SQLSTATE connects to: the concept that explains it, the runbooks that fix it, the parameters you tune to prevent it, and the sibling errors it travels with. All real cross-references. Jump straight in, or open the full interactive map.

Open in the interactive map →

Verification

PG 18.4
Last verified
2026-07-24 (isolated lab, PostgreSQL 18.4)
Verification scope
Verified against PostgreSQL 18.4 in an isolated lab environment
Audit status
reviewed
ShareLinkedInX

Went further?

Pro unlocks the second lab proof

Free page stops the bleeding. Pro adds the operational test, SQLSTATE audit, and deeper evidence, same error, more certainty.

FollowSubstackLinkedInnew errors · lab notes · hiring loops