Re: [patch] A \pivot command for psql

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Daniel Verite" <daniel(at)manitou-mail(dot)org>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: [patch] A \pivot command for psql
Date: 2015-08-10 00:18:06
Message-ID: 25856.1439165886@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

"Daniel Verite" <daniel(at)manitou-mail(dot)org> writes:
> Tom Lane wrote:
>> Is there a way to implement pivoting as a set-returning function?

> Not with the same ease of use. We have crosstab functions
> in contrib/tablefunc already, but the killer problem with PIVOT
> is that truly dynamic columns are never reachable directly.

I'm not sure how pushing it out to psql makes that better. There is
no way to do further processing on something that psql has printed,
so you've punted on solving that issue just as much if not more.

I agree that the crosstab solution leaves a lot to be desired
as far as ease of use goes, but I don't want to define fixing its
ease-of-use problem as being "it's easy for manual use in psql".
psql is a minority API, you know.

Besides which, psql is not all that great for looking at very wide tables,
so I'm not sure that this would be very useful for dynamic column sets
anyway.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2015-08-10 00:58:25 Re: tap tests remove working directories
Previous Message Tom Lane 2015-08-10 00:06:11 Re: Precedence of standard comparison operators