Diagnostic Queries
Symptoms
A table definition exceeded PostgreSQL’s hard limit on the number of columns. PostgreSQL raises SQLSTATE 54011 (too_many_columns).
- A CREATE/ALTER TABLE pushed past the column cap.
- The effective limit is 1600 (often fewer for wide types).
- Common with extremely wide, denormalized tables.
What the server log shows
ERROR: tables can have at most 1600 columns
Why PostgreSQL raises this — what the manual says
Appendix K PostgreSQL Limitations:
“Columns that have been dropped from the table also contribute to the maximum column limit.”
Each row must fit page/tuple constraints, capping columns at 1600 (fewer for wide types). A definition exceeding the cap can’t be stored, so PostgreSQL reports 54011.
Common causes
- An over-denormalized table with too many columns.
- Repeatedly adding columns to a very wide table.
- Generated/EAV-style schemas creating excessive columns.
How to fix it
- Normalize: split the table into related tables.
- Use JSONB or arrays for sparse/variable attributes instead of many columns.
- Reconsider the schema design to stay well under the limit.
Related & next steps
Reference: PostgreSQL 18 Appendix K “Limits”.
Thanks — noted. This helps keep the database accurate.