How do I add a new column between 2 columns in PostgreSQL?

2

How do I add a new column between two columns already in my database in PostgreSQL?

In MySQL do I use the AFTER function to add one column after another, and in PostgreSQL? How do I do this?

SQL

ALTER TABLE nota ADD hota_utc VARCHAR(2) AFTER hora_entrada_saida;
    
asked by anonymous 15.07.2015 / 21:08

1 answer

3

Not possible. The solution is to create a new table with the new structure with the columns the way you want, copy the data to it and after deleting the old one, rename the new one to take the place of the old.

In general the order of the columns is considered irrelevant.

You have an explanation of how to proceed in the product wiki .

    
15.07.2015 / 21:15