# 54000 — program_limit_exceeded

> Source-backed reference for PostgreSQL SQLSTATE 54000.
---

# 54000

## At a glance {#at-a-glance}
`54000` is used when a concrete program, representation, or extension limit is exceeded. Fixed examples include safe allocation-size arithmetic, relation block numbering, array dimensions/size, cube dimensions, and hstore pair counts; the source path identifies the limit.

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

| Field | Value |
| --- | --- |
| SQLSTATE | `54000` |
| Condition | `program_limit_exceeded` |
| Status | `active` |
| Known present by | `7.4` |
| 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_PROGRAM_LIMIT_EXCEEDED` |
| Aliases | `—` |

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

## Meaning {#meaning}
The condition is not a general “large value” warning. Core `mcxt.c` checks addition and multiplication of allocation sizes and emits `invalid memory allocation request size ...` on overflow; relation storage refuses a block number at `InvalidBlockNumber`; array construction/subscripts enforce dimension and total-size limits. Extension paths add their own ceilings: cube reports that a cube cannot have more than `%d` dimensions, while hstore reports actual and maximum pair counts. The operation and source path define the limit.

## Diagnosis {#diagnosis}
Identify the source component and reported actual/maximum values. Check whether this is allocation-size overflow, relation growth, array dimensions/size, cube dimensions, hstore pairs, or another component. Inspect the expression or generated value that expands the request; an allocation-size overflow is a request-arithmetic problem, not proof that the host is out of RAM.

## Response {#response}
Reduce the requested size, dimension, block growth, or pair count; split the value or choose a representation whose documented limit fits the requirement. For relation limits, redesign or partition storage before retrying. If an `ERROR` occurs inside an explicit transaction, use `ROLLBACK` or `ROLLBACK TO SAVEPOINT` before retrying; in autocommit, retry only after the request fits the named program limit. Do not discard elements silently or “fix” arithmetic overflow by blindly raising an unrelated memory setting; preserve the business rule for truncation or decomposition.

## Versions {#versions}
The locked catalogue records this condition from 7.4; cited core and extension paths are PostgreSQL 18.6 source. No limit was forced and no oversized extension value was created.

## Related {#related}
[`54011`](../54011/), [`54023`](../54023/), [`22000`](../22000/)

## Sources {#sources}
[`contrib/cube/cube.c#L162-L166`](https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/contrib/cube/cube.c#L162)

[`contrib/hstore/hstore_io.c#L522-L525`](https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/contrib/hstore/hstore_io.c#L522)

[`src/backend/utils/mmgr/mcxt.c#L1683-L1718`](https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/utils/mmgr/mcxt.c#L1683)

[`src/backend/storage/smgr/md.c#L493-L504`](https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/storage/smgr/md.c#L493)

[`src/backend/utils/adt/arraysubs.c#L147-L152`](https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/utils/adt/arraysubs.c#L147)

The structured [evidence record](../data/evidence/54000.json) records fixed messages and the source/runtime boundary.
