Re: Reordering the fields in a table - Mailing list pgsql-admin

From Alvaro Herrera
Subject Re: Reordering the fields in a table
Date
Msg-id 20210418171927.GA25053@alvherre.pgsql
Whole thread Raw
In response to Reordering the fields in a table  ("Campbell, Lance" <lance@illinois.edu>)
List pgsql-admin
On 2021-Apr-16, Campbell, Lance wrote:

> If there is a way to do this please let me know.
> 
> PostgreSQL Request
> I would love to see an enhancement to PostgreSQL where administrators
> had some way to reorder the fields in their tables.  As a software
> developer I can easily write a tool to reorder the fields in a table
> if there were no foreign keys.  But foreign keys throw an enormous
> hurdle in my way.

Yeah, this feature has been requested many times in the past.  It's a
tough nut to crack though, which is why it doesn't exist today.  I had a
patch partially working that did it, but there were a number of areas in
the code I couldn't figure out how to change, and after spending much
more time than I should have, I abandoned it.

I have learned a few more things since then, and maybe if I attempted it
now, I could make it work.  But I have no plans to work on that at
present.

It is not impossible, just pretty difficult.

-- 
Álvaro Herrera                            39°49'30"S 73°17'W
Officer Krupke, what are we to do?
Gee, officer Krupke, Krup you! (West Side Story, "Gee, Officer Krupke")



pgsql-admin by date:

Previous
From: Julien Rouhaud
Date:
Subject: Re: Recovered data directory
Next
From: Laurenz Albe
Date:
Subject: Re: Reordering the fields in a table