Reordering columns

From: pgadmin(at)weevil(dot)net
To: pgadmin-hackers(at)postgresql(dot)org
Subject: Reordering columns
Date: 2006-09-25 01:30:23
Message-ID: 20060925013023.GO29460@robo.Stanford.EDU
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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)

Browse pgadmin-hackers by date

  From Date Subject
Next Message Hiroshi Saito 2006-09-26 16:18:42 Strange spotted of a GrantWizard Dialog.
Previous Message Dave Page 2006-09-24 21:00:57 Re: SVN Commit by mha: r5399 - trunk/pgadmin3/src/dlg