Re: rotate psql output - Mailing list pgsql-general

From Ben Carbery
Subject Re: rotate psql output
Date
Msg-id AANLkTim4tLpeauaZDD3_ypWLi+7KGs6Wur1fmZ9vY5BN@mail.gmail.com
Whole thread Raw
In response to Re: rotate psql output  (Vincenzo Romano <vincenzo.romano@notorand.it>)
Responses Re: rotate psql output  (Vincenzo Romano <vincenzo.romano@notorand.it>)
List pgsql-general

On Thu, Sep 30, 2010 at 9:36 PM, Vincenzo Romano <vincenzo.romano@notorand.it> wrote:
2010/9/30 Raymond O'Donnell <rod@iol.ie>:
> On 30/09/2010 12:17, Ben Carbery wrote:
> Googling on "sql swap rows columns" found this:
>
> http://stackoverflow.com/questions/584232/t-sql-how-to-swap-rows-and-columns
>
> ...which you'll be able to adapt.

We also have the fantastic crosstab in tablefunc module (see chapter
F.36.1.4 for v9.0.0)

--
Vincenzo Romano at NotOrAnd Information Technologies
Software Hardware Networking Training Support Security
--
NON QVIETIS MARIBVS NAVTA PERITVS


..but these seem to be more pivot table functions that alter the data, rather than displaying it differently. Not sure if this method is adaptable but I may have a go.

To me swapping would be better suited as an option to psql. After all, calling columns 'columns' in sql is aribtrary - they could just as easily have been called rows or something else, so there's no reason for the output to be fixed that way. Although that would chew a lot of memory if you have a lot of records as you would need to read every record before formatting..and I guess that explains why it hasn't been done.

No idea if this can be done in other clients!

pgsql-general by date:

Previous
From: Vincenzo Romano
Date:
Subject: Re: rotate psql output
Next
From: Vincenzo Romano
Date:
Subject: Re: rotate psql output