Change column order in table of postgres
问题 I am trying to change the column order in the table of postgressql. But I didn't get any clue or answer. I think this functionality is add in new version. I am using postgres 11. Ex No column 1 Id 2 Lastname 3 Firstname Now i want to change Firstname on 2nd position. 回答1: You would have to drop and re-create the table or at least the lastname column for that: BEGIN; ALTER TABLE atable RENAME lastname TO oldcol; ALTER TABLE atable ADD lastname text NOT NULL; UPDATE atable SET lastname = oldcol