↑↓ select↵ open⌫ change scopeOpen full search

PG.CENTER connects PostgreSQL documentation, reference, and ecosystem knowledge. Maintained by Pigsty.

Wiki / SQLSTATE

54000 \u2014 program_limit_exceeded

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.

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
Program Limit Exceeded
condition name
program_limit_exceeded
lang
en
sqlstate
54000

Definition PG 18

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.

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, 54023, 22000

Sources {#sources}

contrib/cube/cube.c#L162-L166

contrib/hstore/hstore_io.c#L522-L525

src/backend/utils/mmgr/mcxt.c#L1683-L1718

src/backend/storage/smgr/md.c#L493-L504

src/backend/utils/adt/arraysubs.c#L147-L152

The structured evidence record records fixed messages and the source/runtime boundary.

Compare versions

SQLSTATE evidence and recorded runtime versions

claims · identity
{
  "claim_id": "identity",
  "limits": "",
  "method": "Read fixed definition.",
  "position": 0,
  "runtime": [],
  "sources": [
    "src.errcodes.18.6"
  ],
  "statement": "54000 is program_limit_exceeded in SQLSTATE Class 54."
}
claims · resolved-paths
{
  "claim_id": "resolved-paths",
  "limits": "Source confirmation is not natural runtime.",
  "method": "Read complete fixed source contexts.",
  "position": 1,
  "runtime": [],
  "sources": [
    "src.path.0",
    "src.path.1",
    "src.path.2",
    "src.path.3",
    "src.path.4"
  ],
  "statement": "The cited PostgreSQL 18.6 source paths support the representative resource and object-state mechanisms described."
}
claims · core-limit-mechanisms
{
  "claim_id": "core-limit-mechanisms",
  "limits": "",
  "method": "Read complete fixed guards and their ereport groups.",
  "position": 2,
  "runtime": [],
  "sources": [
    "src.path.2",
    "src.path.3",
    "src.path.4"
  ],
  "statement": "Core safe allocation-size arithmetic, relation block growth, and array subscript dimensions use 54000 independently of cube and hstore extension limits."
}
claims · history
{
  "claim_id": "history",
  "limits": "",
  "method": "Use catalogue boundary.",
  "position": 3,
  "runtime": [],
  "sources": [
    "src.errcodes.18.6"
  ],
  "statement": "The locked catalogue records 54000 from 7.4; that boundary does not prove exact implementation introduction."
}
messages · message.0
{
  "limits": "",
  "message_id": "message.0",
  "path": "",
  "position": 0,
  "raw": {
    "hint_template": "A cube cannot have more than %d dimensions.",
    "id": "message.0",
    "primary_template": "cube dimension limit",
    "severity_source": "ERROR",
    "sources": [
      "src.path.0"
    ],
    "sqlstate": "54000"
  },
  "severity": "ERROR",
  "sources": [
    "src.path.0"
  ],
  "templates": [
    {
      "kind": "primary",
      "literal": "cube dimension limit",
      "position": 0,
      "role": "",
      "template": "cube dimension limit"
    },
    {
      "kind": "hint",
      "literal": "A cube cannot have more than dimensions.",
      "position": 1,
      "role": "",
      "template": "A cube cannot have more than %d dimensions."
    }
  ]
}
messages · message.1
{
  "limits": "",
  "message_id": "message.1",
  "path": "",
  "position": 1,
  "raw": {
    "id": "message.1",
    "primary_template": "number of pairs (%d) exceeds the maximum allowed (%d)",
    "severity_source": "ERROR",
    "sources": [
      "src.path.1"
    ],
    "sqlstate": "54000"
  },
  "severity": "ERROR",
  "sources": [
    "src.path.1"
  ],
  "templates": [
    {
      "kind": "primary",
      "literal": "number of pairs ( ) exceeds the maximum allowed ( )",
      "position": 0,
      "role": "",
      "template": "number of pairs (%d) exceeds the maximum allowed (%d)"
    }
  ]
}
messages · message.2
{
  "limits": "",
  "message_id": "message.2",
  "path": "",
  "position": 2,
  "raw": {
    "id": "message.2",
    "primary_template": "invalid memory allocation request size %zu + %zu",
    "severity_source": "ERROR",
    "sources": [
      "src.path.2"
    ],
    "sqlstate": "54000"
  },
  "severity": "ERROR",
  "sources": [
    "src.path.2"
  ],
  "templates": [
    {
      "kind": "primary",
      "literal": "invalid memory allocation request size u + u",
      "position": 0,
      "role": "",
      "template": "invalid memory allocation request size %zu + %zu"
    }
  ]
}
messages · message.3
{
  "limits": "",
  "message_id": "message.3",
  "path": "",
  "position": 3,
  "raw": {
    "id": "message.3",
    "primary_template": "cannot extend file \"%s\" beyond %u blocks",
    "severity_source": "ERROR",
    "sources": [
      "src.path.3"
    ],
    "sqlstate": "54000"
  },
  "severity": "ERROR",
  "sources": [
    "src.path.3"
  ],
  "templates": [
    {
      "kind": "primary",
      "literal": "cannot extend file \" \" beyond blocks",
      "position": 0,
      "role": "",
      "template": "cannot extend file \"%s\" beyond %u blocks"
    }
  ]
}
messages · message.4
{
  "limits": "",
  "message_id": "message.4",
  "path": "",
  "position": 4,
  "raw": {
    "id": "message.4",
    "primary_template": "number of array dimensions (%d) exceeds the maximum allowed (%d)",
    "severity_source": "ERROR",
    "sources": [
      "src.path.4"
    ],
    "sqlstate": "54000"
  },
  "severity": "ERROR",
  "sources": [
    "src.path.4"
  ],
  "templates": [
    {
      "kind": "primary",
      "literal": "number of array dimensions ( ) exceeds the maximum allowed ( )",
      "position": 0,
      "role": "",
      "template": "number of array dimensions (%d) exceeds the maximum allowed (%d)"
    }
  ]
}
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#L416"
}
sources · src.path.0
{
  "commit": "724edf9bde9d356724ad384a2e196edc3c9f80f7",
  "docs_url": "",
  "kind": "upstream_source",
  "location": "",
  "path": "contrib/cube/cube.c",
  "position": 1,
  "sha256": "6094de3208056ddc0a9756ed63a9b9d776be81e555d8240e69c864d7f0e6a9d2",
  "source_id": "src.path.0",
  "tag": "REL_18_6",
  "url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/contrib/cube/cube.c#L162"
}
sources · src.path.1
{
  "commit": "724edf9bde9d356724ad384a2e196edc3c9f80f7",
  "docs_url": "",
  "kind": "upstream_source",
  "location": "",
  "path": "contrib/hstore/hstore_io.c",
  "position": 2,
  "sha256": "4f9e853ca79e1412d989e937749eeb2a251f7e8173d2732098e4c8a67a96b3d4",
  "source_id": "src.path.1",
  "tag": "REL_18_6",
  "url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/contrib/hstore/hstore_io.c#L522"
}
sources · src.path.2
{
  "commit": "724edf9bde9d356724ad384a2e196edc3c9f80f7",
  "docs_url": "",
  "kind": "upstream_source",
  "location": "",
  "path": "src/backend/utils/mmgr/mcxt.c",
  "position": 3,
  "sha256": "19824d40a1b2b7f533fd7863c91117a33c0879bf776fc7fbe495f603e032344e",
  "source_id": "src.path.2",
  "tag": "REL_18_6",
  "url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/utils/mmgr/mcxt.c#L1683"
}
sources · src.path.3
{
  "commit": "724edf9bde9d356724ad384a2e196edc3c9f80f7",
  "docs_url": "",
  "kind": "upstream_source",
  "location": "",
  "path": "src/backend/storage/smgr/md.c",
  "position": 4,
  "sha256": "c7e885c50b381337b8b8624bfc8effbd3abba7aa95a290083996354926ec9f69",
  "source_id": "src.path.3",
  "tag": "REL_18_6",
  "url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/storage/smgr/md.c#L493"
}
sources · src.path.4
{
  "commit": "724edf9bde9d356724ad384a2e196edc3c9f80f7",
  "docs_url": "",
  "kind": "upstream_source",
  "location": "",
  "path": "src/backend/utils/adt/arraysubs.c",
  "position": 5,
  "sha256": "59b00fb9b770f84eb97948e1e2dd339b25f4fbc331fdf972d0f1b13fd2a7e4ad",
  "source_id": "src.path.4",
  "tag": "REL_18_6",
  "url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/utils/adt/arraysubs.c#L147"
}

Source references

Full definition and evidence JSON

Definition sources

center · PostgreSQL 18 · english-manuals:70dfa1a89637e901709265b7b0824f3065991d2c1b2978122b5e8b7f65f19f23

Text language: en · english-manuals:70dfa1a89637e901709265b7b0824f3065991d2c1b2978122b5e8b7f65f19f23