I have a existing table with some columns , my objective is to add a new column at the first position using postgres, how can i do this? Any suggestions will be helpful.
Asked
Active
Viewed 8,223 times
1 Answers
1
I think that this has already been (not) answered. Postgresql doesn't feel column order is significant.
How to alter position of postgres columns
"Alter column position" in the PostgreSQL Wiki says:
PostgreSQL currently defines column order based on the attnum column of the pg_attribute table. The only way to change column order is either by recreating the table, or by adding columns and rotating data until you reach the desired layout.

RedCabbage
- 53
- 5
-
Rather than adding this link-only answer, you should have flagged the question as a duplicate. – Laurenz Albe Oct 29 '20 at 10:40
-
5Thanks for the advice. (Though I don't believe that I can flag as duplicate until I have a higher rank) – RedCabbage Oct 29 '20 at 11:51