From: | "Daniel Verite" <daniel(at)manitou-mail(dot)org> |
---|---|
To: | "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | "Dean Rasheed" <dean(dot)a(dot)rasheed(at)gmail(dot)com>, "Pavel Stehule" <pavel(dot)stehule(at)gmail(dot)com>, "Alvaro Herrera" <alvherre(at)2ndquadrant(dot)com>, "Teodor Sigaev" <teodor(at)sigaev(dot)ru>, "PostgreSQL Hackers" <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: [patch] Proposal for \crosstabview in psql |
Date: | 2016-02-09 17:31:53 |
Message-ID: | 9e71314f-6cca-4495-b771-b083e07442ae@mm |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Tom Lane wrote:
> I do not think we want any client-side sorting in this feature at all,
> because the minute you have any such thing, you are going to have an
> absolutely never-ending stream of demands for more sorting features:
> multi column, numeric vs text, ASC vs DESC, locale-aware, etc etc etc.
It doesn't really do any client-side sorting, the rest of the thread might
refer to it like that by oversimplification, but if the command requests
a header to be sorted, a "backdoor-style" query of this form
is sent to the server, with PQexecParams():
SELECT n FROM (VALUES ($1,1),($2,2),($3,3)...) ) AS l(x,n)
ORDER BY x [DESC]
where the values to display in the header are bound to
$1,$2,.. and the type associated with these parameters is
the PQftype() of the field from which these values come.
Then the <n> values coming back ordered by <x> tell us
where to position the values corresponding to $1,$2... in the
sorted header.
There are some cases when this sort cannot work.
For example if the field is an anonymous type or a ROW().
Or if the field is POINT(x,y), because our "point" type
does not support order by.
I believe these are corner cases for this feature. In these
cases, psql just displays the error message that PQexecParams()
emits.
Best regards,
--
Daniel Vérité
PostgreSQL-powered mailer: http://www.manitou-mail.org
Twitter: @DanielVerite
From | Date | Subject | |
---|---|---|---|
Next Message | Robert Haas | 2016-02-09 17:35:30 | Re: [PATCH] Refactoring of LWLock tranches |
Previous Message | Fujii Masao | 2016-02-09 17:23:06 | Re: Existence check for suitable index in advance when concurrently refreshing. |