I havent checked postgres - quite possible it has a similar problem.
Then, even if the DDL is fixed, there is still the fact that recreating the old pk column cant become the primary key unless the the recreated column is given values for the existing rows, and how to populate that field cant easily be automatically generated.
We had a table with two id column, and switched the pk from one id to the other id column, and dropped the old id column.
i.e. before
after
The migration works well. However rollback fails because it starts with
This fails with
I havent checked postgres - quite possible it has a similar problem.
Then, even if the DDL is fixed, there is still the fact that recreating the old pk column cant become the primary key unless the the recreated column is given values for the existing rows, and how to populate that field cant easily be automatically generated.