Unix Technical Forum

Reordering columns

This is a discussion on Reordering columns within the pgsql Interfaces Pgadmin Hackers forums, part of the PostgreSQL category; --> Howdy, I was thinking of adding a feature to pgadmin3, and I just wanted to make sure there wasn't ...


Go Back   Unix Technical Forum > Database Server Software > PostgreSQL > pgsql Interfaces Pgadmin Hackers

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-17-2008, 06:19 PM
pgadmin@weevil.net
 
Posts: n/a
Default Reordering columns

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)

---------------------------(end of broadcast)---------------------------
TIP 1: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo@postgresql.org so that your
message can get through to the mailing list cleanly

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 02:36 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com