Reordering columns - Mailing list pgadmin-hackers

From pgadmin@weevil.net
Subject Reordering columns
Date
Msg-id 20060925013023.GO29460@robo.Stanford.EDU
Whole thread Raw
List pgadmin-hackers
Howdy,

I was thinking of adding a feature to pgadmin3, and I just wanted to
make sure there wasn't already someone working on it to avoid
duplicating effort.

It would be really nice to be able to either reorder the columns of a
table or insert a new column at an arbitrary position.  While PostgreSQL
doesn't support this as such, you can achieve the same effect by:

- Renaming the original table and all its constraints & triggers
- Creating a new table with the desired schema
- Inserting everything from the renamed old table into the new table
- Re-creating the constraints & triggers
- Dropping the old table, old constraints, and old triggers

At one of my previous jobs, I used an awesome tool called DBArtisan that
did exactly this (we use Sybase, which has [or had] the same limitation
as PostgreSQL of not natively supporting reordering of table columns).
If you added a new column at the end of a table, it would simply issue
an ALTER TABLE command, but if you added one in the middle, or reordered
existing columns, it would build a query as I've described above.

Any thoughts, suggestions, criticisms would be appreciated.

Cheers,
Tony

--
(lambda x. x x) (lambda x. x x)

pgadmin-hackers by date:

Previous
From: "Dave Page"
Date:
Subject: Re: SVN Commit by mha: r5399 - trunk/pgadmin3/src/dlg
Next
From: "Hiroshi Saito"
Date:
Subject: Strange spotted of a GrantWizard Dialog.