Reputation: 163
Nest] 10504 - 20/01/2023, 15:47:27 ERROR [TypeOrmModule] Unable to connect to the database. Retrying (1)...
QueryFailedError: tables can have at most 1600 columns
at PostgresQueryRunner.query (C:\Users\Public\Backend\src\driver\postgres\PostgresQueryRunner.ts:299:19)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at PostgresQueryRunner.executeQueries (C:\Users\Public\Backend\src\query-runner\BaseQueryRunner.ts:609:13)
at PostgresQueryRunner.addColumn (C:\Users\Public\Backend\src\driver\postgres\PostgresQueryRunner.ts:1039:9)
at PostgresQueryRunner.addColumns (C:\Users\Public\Backend\src\driver\postgres\PostgresQueryRunner.ts:1053:13)
at RdbmsSchemaBuilder.addNewColumns (C:\Users\Public\Backend\src\schema-builder\RdbmsSchemaBuilder.ts:737:13)
at RdbmsSchemaBuilder.executeSchemaSyncOperationsInProperOrder (C:\Users\Public\Backend\src\schema-builder\RdbmsSchemaBuilder.ts:213:9)
at RdbmsSchemaBuilder.build (C:\Users\Public\Backend\src\schema-builder\RdbmsSchemaBuilder.ts:92:13)
at DataSource.synchronize (C:\Users\Public\Backend\src\data-source\DataSource.ts:317:9)
at DataSource.initialize (C:\Users\Public\Backend\src\data-source\DataSource.ts:255:43)
I'm thinking because an item was inserted wrong, or I don't know.
Upvotes: 3
Views: 718
Reputation: 21485
The error message is "tables can have at most 1600 columns", and the stack trace indicates that you encountered it while calling addColumn
-- so the first thing to check is whether you've run this code enough times that you've accidentally made a 1600-column table.
If you have other code that deletes those columns, you may need to rebuild the table; according to this, deleted columns may still count towards that limitation. The suggested workaround is to back up your data, drop the table, and restore it from backup.
Upvotes: 1