Re: Reordering the fields in a table

From: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
To: "Campbell, Lance" <lance(at)illinois(dot)edu>
Cc: "pgsql-admin(at)lists(dot)postgresql(dot)org" <pgsql-admin(at)lists(dot)postgresql(dot)org>
Subject: Re: Reordering the fields in a table
Date: 2021-04-18 17:19:27
Message-ID: 20210418171927.GA25053@alvherre.pgsql
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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")

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Laurenz Albe 2021-04-18 20:16:34 Re: Reordering the fields in a table
Previous Message Julien Rouhaud 2021-04-18 12:54:01 Re: Recovered data directory