I want to add a column in a table of a databse such that the column always remain as the last column even if the new columns are added later. example:
Name, Id, Address
I need to add column timestamp which will be done by alter command and it will add column at the last index . So after adding timestamp column
Name, Id, Address, timestamp
Now suppose in future if a new requirement came to add new column phone_number an alter command will be run which will add phone_number after timestamp column
Name, Id, Address, timestamp, phone_number
If we want to add phone_number before timestamp we can use AFTER clause and can add phone_number after Address,so it will become
Name, Id, Address, phone_number, timestamp
but suppose some users forget to use the AFTER clause which will place the phone_number after timestamp and hence will break the logic which says the timestamp must be as the last column.
So is there any way to keep the timestamp column at the last always ?
AFTERclause in Postgres?,If we want to add phone_number before timestamp we can use AFTER clause, what your saying??.You must thoroughly read ALTER TABLE - Vivek S.