Re: Rearrange Column

From: Dave Caughey <caugheyd(at)gmail(dot)com>
To: richard coleman <rcoleman(dot)ascentgl(at)gmail(dot)com>
Cc: Sachin Kumar <sachinkumaras(at)gmail(dot)com>, pgAdmin Support <pgadmin-support(at)postgresql(dot)org>
Subject: Re: Rearrange Column
Date: 2021-04-22 15:25:29
Message-ID: CAAj2gHyhMPWFW8-ioBGGcqqMQy8O5rqHkvx2MdfT+kjTFtoSdw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgadmin-support

Rik,

Clearly, if you do

SELECT colA, colB FROM MyTable

vs

SELECT colB, colA FROM MyTable

you'll get the results in a different sequence. Obviously, using this
approach has not manipulated the underlying table (your interpretation of
what the OP is asking for), but perhaps the OP's question is that they're
wondering if the *reporting* tool (i.e., pgAdmin) could hopefully allow you
to rearrange the sequence in which a table's columns are displayed so that
when you do a

SELECT * FROM MyTable

pgAdmin will take care of manipulating the results of the query to
*display* the columns in a specified sequence.

Yes, the OP currently has the ability to craft a custom query, e.g.,

SELECT colA, colB, colZ, colT, colC, colQ, colD, colE...

to get the exact order they want, but it would actually be nice if the
reporting tool took care of this for you so you could just specify "SELECT
*" and get the columns in the way you want to see them, or, should they be
using "View/Edit Rows" pgAdmin would again show the rows in the prefered
order.

Cheers,
Dave

On Thu, Apr 22, 2021 at 11:01 AM richard coleman <
rcoleman(dot)ascentgl(at)gmail(dot)com> wrote:

> Sachin,
>
> Umm, I hate to be the one to break it to you, but *postgreSQL *doesn't
> support rearranging columns in a table, short of dropping them and
> re-adding them in the desired order. Since postgreSQL itself doesn't
> support that, I would be truly amazed to learn that pgAdmin4 managed to
> accomplish that trick.
>
> If I'm wrong, someone *please* let me know.
>
> rik.
>
> On Thu, Apr 22, 2021 at 9:53 AM Sachin Kumar <sachinkumaras(at)gmail(dot)com>
> wrote:
>
>> Hi Team,
>>
>> How can we rearrange the column of PostgreSQL using PGADMIN?
>>
>> --
>>
>> Best Regards,
>> Sachin Kumar
>>
>

In response to

Responses

Browse pgadmin-support by date

  From Date Subject
Next Message richard coleman 2021-04-22 15:58:33 Re: Rearrange Column
Previous Message richard coleman 2021-04-22 15:00:58 Re: Rearrange Column