Re: [patch] Proposal for \crosstabview in psql

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com>
Cc: Andres Freund <andres(at)anarazel(dot)de>, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, Daniel Verite <daniel(at)manitou-mail(dot)org>, 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-11 10:29:55
Message-ID: CAFj8pRCwx=r0nU63QJFHYZBwLcfXD2bTmpr7omAXp3FSf14A0Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Thinking about this some more though, perhaps *sorting* the columns is
> the wrong way to be thinking about it. Perhaps a better approach would
> be to allow the columns to be *listed* (optionally, using a separate
> query). Something like the following (don't get too hung up on the
> syntax):
>
> SELECT name,
> to_char(date, 'Mon') AS month,
> sum(amount) AS amount
> FROM invoices
> GROUP BY 1,2
> ORDER BY name
> \crosstabview cols = (select to_char(d, 'Mon') from
> generate_series('2000-01-01'::date, '2000-12-01', '1 month') d)
>

The idea is ok, but this design cannot be described as user friendly. The
work with time dimension is pretty common, and should be supported by some
short user friendly syntax.

Regards

Pavel

>
> Regards,
> Dean
>

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Teodor Sigaev 2016-02-11 12:30:44 Re: Fuzzy substring searching with the pg_trgm extension
Previous Message Dean Rasheed 2016-02-11 10:21:27 Re: [patch] Proposal for \crosstabview in psql