Online Documentation for SQL Manager for PostgreSQL
Changing fields order
The Reorder Columns dialog allows you to change the fields order in the table.
To open this dialog, open the table in Table Editor, proceed to the Fields tab there, right-click within the Fields list and select the Reorder Fields item from the context menu.
NB: Since PostgreSQL server does not have a native command for reordering table fields, this operation is implemented in SQL Manager for PostgreSQL by generating the script according to which the data of the original table are copied into a temporary table, then the original table is dropped, and a new table with the same name but having the newly specified order of fields is created, and afterwards all the data are copied from the temporary table into the new one.
Nevertheless such script cannot be executed in some cases. If a table is referenced by another table (e.g. there is a Foreign Key constraint) or is a base table for a view, the Reorder Fields operation cannot be performed. It is recommended to drop Foreign Keys before field reordering, and create them again after the reordering operation is completed.
By default, before the Reorder Columns dialog is opened, a warning window is displayed. Use the Operations by recreating drop-down list to specify whether the Reorder Fields operation will be available after the current operation is performed:
Enabled - such operation will be performed without warnings;
Enabled, show warning - the warning window will appear if the operation requires table recreation;
Disabled - denies operations of this type.
The fields are displayed in the Column name list in the current order.
To change the fields order, use the buttons or drag-and-drop operations within the list. Click the OK button to view the modification script in the Changing Metadata window and apply changes.