Re: rotate psql output

From: Ben Carbery <ben(dot)carbery(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: rotate psql output
Date: 2010-09-30 11:46:14
Message-ID: AANLkTim4tLpeauaZDD3_ypWLi+7KGs6Wur1fmZ9vY5BN@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Thu, Sep 30, 2010 at 9:36 PM, Vincenzo Romano <
vincenzo(dot)romano(at)notorand(dot)it> wrote:

> 2010/9/30 Raymond O'Donnell <rod(at)iol(dot)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!

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Vincenzo Romano 2010-09-30 11:49:22 Re: rotate psql output
Previous Message Vincenzo Romano 2010-09-30 11:36:55 Re: rotate psql output