I would like to know if there is a way to add columns later after a certain column in postgre, as in mysql that aría in this way
alter table personal add capital int not null after nom;
I would like to know if there is any way in postgresql
I would like to know if there is a way to add columns later after a certain column in postgre, as in mysql that aría in this way
alter table personal add capital int not null after nom;
I would like to know if there is any way in postgresql
Can not. In postgres the new columns always go to the end.
According to the wiki, there are two workarounds :
As you can see, neither of the two solutions is very beautiful.
If the table has no information, just truncate and create again in the order you want the fields to be. If the table has many records, create a new auxiliary table and pass the information to this new auxiliary table, truncate the table that does not have the fields order and create again in the order you need, pass the records of the auxiliary table to the table already with the ordered columns, truncates the auxiliary table, ready.