Re: [patch] A \pivot command for psql - Mailing list pgsql-hackers

From Tom Lane
Subject Re: [patch] A \pivot command for psql
Date
Msg-id 25856.1439165886@sss.pgh.pa.us
Whole thread Raw
In response to Re: [patch] A \pivot command for psql  ("Daniel Verite" <daniel@manitou-mail.org>)
Responses Re: [patch] A \pivot command for psql  ("Daniel Verite" <daniel@manitou-mail.org>)
Re: [patch] A \pivot command for psql  (Robert Haas <robertmhaas@gmail.com>)
List pgsql-hackers
"Daniel Verite" <daniel@manitou-mail.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



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Precedence of standard comparison operators
Next
From: Michael Paquier
Date:
Subject: Re: tap tests remove working directories