I have a table with some columns and I would like to change the order of the columns akin to the following example
SomeTable
columnId, column1, column2, column3 etc...
I have tried the following syntax:
ALTER TABLE some_table
ORDER BY id, column2, column3, column1;
ALTER TABLE table_name
MODIFY COLUMN column_name1 data_type AFTER column_name2;
I am using postgresql server 15. I want to execute the changes through liquibase migration.
I could drop the table and redo the sql in the desired order, but this seems overkill for what it achieves.
Now, I get that this is a small gripe as it is almost inconsequential beyond some admittedly minor human ergonomic improvements, but, tbh for me it is more a case of professional curiosity. How is it that it isn't possible.
According to this article this is basically impossible.
However! This article is last edited 8 years ago and there has been consistent interest in this functionality for over 20 years - as explained in the article itself. So, if this functionality truly has not been implemented, there is perhaps a significant hurdle that disables the functionality or renders it's implementation not worthwhile.
So at this point while finding out how to do it effectively is still something I am after, underlying knowledge on the "Why" is perhaps even more intriguing.