42P16: invalid_table_definition
PostgreSQLWhat does it mean?
The DDL command was rejected because the table definition is invalid. The requested table/column structure violates PostgreSQL rules.
Why does it happen?
Situations such as defining more than one primary key ('multiple primary keys for table are not allowed'), definitions conflicting with inheritance, generated/identity column restrictions, or a change to a structure that ALTER TABLE cannot produce. Common in auto-generated migration scripts.
How to fix it
Read the specific reason in the error message. Define only one PRIMARY KEY; if a multi-column key is needed, use a composite key of the form PRIMARY KEY (a, b). Review the identity/generated column rules. Check the current table definition with \d my_table and fix the migration script.