Re: [GENERAL] Reordering columns in a table

2006-01-10 Thread Jim C. Nasby
On Sat, Jan 07, 2006 at 02:45:44PM -0500, Robert Treat wrote: > You should be able to do this now using pg_depend, it would just take a bit > of > leg-work. Pretty sure it would be easier than solving physical/logical > attribute separation. Someone writing a pg_list_all_dependencies function

Re: [GENERAL] Reordering columns in a table

2006-01-07 Thread Robert Treat
You should be able to do this now using pg_depend, it would just take a bit of leg-work. Pretty sure it would be easier than solving physical/logical attribute separation. Someone writing a pg_list_all_dependencies function would make for a really good head start... I wonder if the newsysviews

Re: [GENERAL] Reordering columns in a table

2006-01-06 Thread Ian Harding
As I recall, the MS SQL Server draggy droppy diagrammer tool made it seem trivial to rearrange columns did the same thing. It just generated SQL statements to: Begin transaction select data in new order into a new table drop dependent objects drop old table rename new table re-create dependent ob

Re: [GENERAL] Reordering columns in a table

2006-01-06 Thread Scott Ribe
> I would assume > that all dependent database objects are also dropped when you drop the > table, so you'd have to recreate all of your foreign keys (both > directions) and triggers etc.? Basically. I try to keep my DDL scripts organized in a way that makes this easy. Of course an automated tool

Re: [GENERAL] Reordering columns in a table

2006-01-06 Thread Tom Lane
"Jim C. Nasby" <[EMAIL PROTECTED]> writes: > Actually, I'm pretty sure this is on the TODO. [ checks... ] No, it isn't. My recollection is that we looked very hard at this around the time DROP COLUMN was implemented, and concluded that we weren't ever going to support it, because distinguishing

Re: [GENERAL] Reordering columns in a table

2006-01-06 Thread Jim C. Nasby
Actually, I'm pretty sure this is on the TODO. It can't really happen until we have the ability to somehow divorce on-disk ordering from what's presented in the catalog. It's not exactly rocket science to make this happen, but it is quite a bit of work... On Fri, Jan 06, 2006 at 10:59:12AM -0600,

Re: [GENERAL] Reordering columns in a table

2006-01-06 Thread Andreas Kretschmer
John McCawley <[EMAIL PROTECTED]> schrieb: > OK, one last question on the subject and I'll shut up. I would assume that > all dependent database objects are also dropped when you drop the table, so > you'd have to recreate all of your foreign keys (both directions) and > triggers etc.? Um, ye

Re: [GENERAL] Reordering columns in a table

2006-01-06 Thread Berend Tober
Andreas Kretschmer wrote: John McCawley <[EMAIL PROTECTED]> schrieb: However, in the real world, ... ...And i think, other systems do this: - begin - create a new temp. table with the new order - insert all values from the old table in the new temp. table - drop the old table - renam

Re: [GENERAL] Reordering columns in a table

2006-01-06 Thread John McCawley
OK, one last question on the subject and I'll shut up. I would assume that all dependent database objects are also dropped when you drop the table, so you'd have to recreate all of your foreign keys (both directions) and triggers etc.? Andreas Kretschmer wrote: John McCawley <[EMAIL PROTECT

Re: [GENERAL] Reordering columns in a table

2006-01-06 Thread Andreas Kretschmer
John McCawley <[EMAIL PROTECTED]> schrieb: > However, in the real world, columns are often added willy-nilly as they are > needed, and it is not immediately obvious which, if any, of the columns > will be related. Later, solely for visual clarity, it is desirable to have > the ability to reorde

Re: [GENERAL] Reordering columns in a table

2006-01-06 Thread John McCawley
I would certainly never have any of my normal application code depend on the ordering of columns. My desire for column ordering is strictly for administration purposes, keeping the visual clarity of the datamodel, and ensuring that the visual datamodel is consistent with what is actually in th

Re: [GENERAL] Reordering columns in a table

2006-01-06 Thread Andreas Kretschmer
John McCawley <[EMAIL PROTECTED]> schrieb: > I believe that it makes a lot of practical difference, just like organizing > related code into files, classes etc. is important for clarity. This isn't > a trivial thing, and the other (sarcastic?) suggestion that I reorder my > select misses the p

Re: [GENERAL] Reordering columns in a table

2006-01-06 Thread John McCawley
I believe that it makes a lot of practical difference, just like organizing related code into files, classes etc. is important for clarity. This isn't a trivial thing, and the other (sarcastic?) suggestion that I reorder my select misses the point. I think that having a good visual representa

Re: [GENERAL] Reordering columns in a table

2006-01-06 Thread A. Kretschmer
am 06.01.2006, um 9:45:53 -0600 mailte John McCawley folgendes: > Is there a way to change the order of columns in a table in Postgres after > it has been created? Back when I used MS SQL Server, it was trivial to go Yes. 'select foo, bar, batz from table', 'select bar, foo, batz from table'

Re: [GENERAL] Reordering columns in a table

2006-01-06 Thread Berend Tober
John McCawley wrote: Is there a way to change the order of columns in a table in Postgres after it has been created? ... The best way to do it is when you have the opportunity to do a restore, edit the pg_dump output between the dump and the restore steps. There are other approaches that mi

Re: [GENERAL] Reordering columns in a table

2006-01-06 Thread Joshua D. Drake
John McCawley wrote: Is there a way to change the order of columns in a table in Postgres after it has been created? Back when I used MS SQL Server, it was trivial to go into Enterprise Manager and move columns up and down. I find this a desirable feature, as I like to keep like columns grou

[GENERAL] Reordering columns in a table

2006-01-06 Thread John McCawley
Is there a way to change the order of columns in a table in Postgres after it has been created? Back when I used MS SQL Server, it was trivial to go into Enterprise Manager and move columns up and down. I find this a desirable feature, as I like to keep like columns grouped in my table. Some