select open change scope Open full search

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

SQLSTATE / CLASS 54 · PROGRAM LIMIT EXCEEDED

too_many_columns

SQLSTATE
54011
Condition name
too_many_columns
Class
Program Limit Exceeded
Source macro
ERRCODE_TOO_MANY_COLUMNS
Evidence
Source path confirmed
Analysis & operational context

English SQLSTATE atlas: authored explanations and source/runtime evidence are separate from the manual definitions. View source ↗

<h1>54011</h1>

At a glance

54011 reports that a physical tuple descriptor or a related object definition exceeds its fixed column limit. The source path determines whether the count is for table attributes, index keys plus INCLUDE columns, partition keys, statistics dimensions, or a row-producing definition.

Meaning

Fixed messages include number of columns (%d) exceeds limit (%d), tables can have at most %d columns, cannot use more than %d columns in an index, cannot partition using more than %d columns, and statistics-specific forms. Table counts operate on physical attribute numbers: a dropped column still occupies a tuple-descriptor slot, so the visible-column count can be lower than relnatts. Index key and INCLUDE entries, partition keys, and statistics dimensions use separate limits even though all use this SQLSTATE.

In the locked 18.6 build, the relevant constants are MaxHeapAttributeNumber = 1600 user table attributes, MaxTupleAttributeNumber = 1664 tuple attributes, INDEX_MAX_KEYS = 32, PARTITION_MAX_KEYS = 32, and STATS_MAX_DIMENSIONS = 8. These values belong to different guards; the actual count and limit fields in a server diagnostic remain authoritative.

Diagnosis

Read the object type, actual count, maximum, and DDL operation from the message and context. For a table or inherited table, inspect pg_class.relnatts and pg_attribute, including attisdropped, rather than counting only visible names. For an index include INCLUDE columns in the DDL count; for partitioning and extended statistics use their own key/dimension counts. A function-in-FROM column definition list is another 54011 path with a row-shape limit.

Response

Reduce or split the object definition, use a different index or partitioning design, or move derived data to a related table. If dropped physical slots are the cause, dropping another visible column will not reclaim them; an ordinary physical rewrite such as VACUUM FULL or CLUSTER also keeps the dropped attributes in the tuple descriptor. Plan a new table with the intended logical column layout, migrate data while preserving dependencies, and validate DDL against the named object limit. If an ERROR occurs inside an explicit transaction, use ROLLBACK or ROLLBACK TO SAVEPOINT before retrying; in autocommit, retry only after the schema change removes the actual limit.

Versions

The locked catalogue records this condition from 7.4; cited heap, index, table, partition, statistics, and row-shape paths are PostgreSQL 18.6 source. No oversized schema was created.

Sources

src/backend/access/common/heaptuple.c#L1131-L1134

src/backend/access/common/indextuple.c#L87-L90

src/backend/catalog/heap.c#L461-L464

src/backend/commands/tablecmds.c#L2567-L2582

src/backend/commands/indexcmds.c#L640-L664

src/backend/commands/statscmds.c#L215-L224

src/backend/parser/parse_relation.c#L1935-L1946

src/include/access/htup_details.h#L34-L48

src/include/pg_config_manual.h#L63-L74

src/include/statistics/statistics.h#L19

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

Source evidence

Evidence belongs to the frozen source and runtime versions listed here. It is not a runtime verification of the selected manual version.

54011 is too_many_columns in SQLSTATE Class 54.

Method: Read fixed definition.

src.errcodes.18.6

The cited PostgreSQL 18.6 source paths support the representative resource and object-state mechanisms described.

Method: Read complete fixed source contexts.

Limits: Source confirmation is not natural runtime.

src.path.0 src.path.1 src.path.2 src.path.3 src.path.4 src.path.5 src.path.6 src.path.7 src.path.8 src.path.9

The table guard counts physical attributes including inherited columns, while index, partition, statistics, and function-row definitions use separate fixed arrays or dimensions.

Method: Read the complete DDL and parser guards.

src.path.3 src.path.4 src.path.5 src.path.6

The fixed 18.6 limit definitions are 1600 user table attributes, 1664 tuple attributes, 32 index keys, 32 partition-key columns, and 8 extended-statistics dimensions; these values belong to different object paths.

Method: Read the fixed macro definitions used by the guards.

Limits: The numeric values are for the locked 18.6 source and do not replace the actual count and limit fields in a future server's diagnostic.

src.path.7 src.path.8 src.path.9

The locked catalogue records 54011 from 7.4; that boundary does not prove exact implementation introduction.

Method: Use catalogue boundary.

src.errcodes.18.6

Message templates

ERROR · message.0

Primary

number of columns (%d) exceeds limit (%d)
ERROR · message.1

Primary

number of index columns (%d) exceeds limit (%d)
ERROR · message.2

Primary

tables can have at most %d columns
ERROR · message.3

Primary

cannot partition using more than %d columns
ERROR · message.4

Primary

cannot use more than %d columns in an index
ERROR · message.5

Primary

cannot have more than %d columns in statistics
ERROR · message.6

Primary

column definition lists can have at most %d entries

Reproduction & repair cases

No reproduction case is attached to this condition.

Recorded runtime evidence

No runtime observation is attached to this entry.

Definition snapshot: english-manuals:a8714de850866235b0780010fa7… · English manual source