Re: [patch] Proposal for \crosstabview in psql - Mailing list pgsql-hackers

From Dean Rasheed
Subject Re: [patch] Proposal for \crosstabview in psql
Date
Msg-id CAEZATCVDk0UOzNK_Fn7Z6b4UNY7=sVz-yAWENHG8K+CxU6rbcg@mail.gmail.com
Whole thread Raw
In response to Re: [patch] Proposal for \crosstabview in psql  (Pavel Stehule <pavel.stehule@gmail.com>)
Responses Re: [patch] Proposal for \crosstabview in psql
Re: [patch] Proposal for \crosstabview in psql
Re: [patch] Proposal for \crosstabview in psql
List pgsql-hackers
On 9 February 2016 at 05:24, Pavel Stehule <pavel.stehule@gmail.com> wrote:
> I have not a feeling so we did some with Daniel privately. All work was
> public (I checked my mailbox) - but what is unhappy - in more mailing list
> threads (not sure how it is possible, because subjects looks same). The
> discus about the design was public, I am sure. It was relative longer
> process, with good progress (from my perspective), because Daniel accepts
> and fixed all my objection. The proposed syntax is fully consistent with
> other psql commands - hard to create something new there, because psql
> parser is pretty limited. Although I am thinking so syntax is good, clean
> and useful I am open to discuss about it. Please, try the last design, last
> patch - I spent lot of hours (and I am sure so Daniel much more) in thinking
> how this can be designed better.
>

Looking at this patch, I have mixed feelings about it. On the one hand
I really like the look of the output, and I can see that the non-fixed
nature of the output columns makes this hard to achieve server-side.

But on the other hand, this seems to be going way beyond the normal
level of result formatting that something like \x does, and I find the
syntax for sorting particularly ugly. I can understand the need to
sort the colH values, but it seems to me that the result rows should
just be returned in the order the server returns them -- i.e., I don't
think we should allow sorting colV values client-side, overriding a
server-side ORDER BY clause in the query.

Client-side sorting makes me uneasy in general, and I think it should
be restricted to just sorting the columns that appear in the output
(the colH values). This would also allow the syntax to be simplified:

\crosstabview [colV] [colH] [colG1[,colG2...]] [sortCol [asc|desc]]

Overall, I like the feature, but I'm not convinced that it's ready in
its current form.

For the future (not in this first version of the patch), since the
transformation is more than just a \x-type formatting of the query
results, a nice-to-have feature would be a way to save the results
somewhere -- say by making it play nicely with \g or \copy somehow,
but I admit that I don't know exactly how that would work.

Regards,
Dean



pgsql-hackers by date:

Previous
From: Heikki Linnakangas
Date:
Subject: Re: [Proposal] Improvement of GiST page layout
Next
From: Sandro Santilli
Date:
Subject: ALTER EXTENSION DROP FUNCTION not working ?