Re: [patch] A \pivot command for psql

From: "Daniel Verite" <daniel(at)manitou-mail(dot)org>
To: "David Fetter" <david(at)fetter(dot)org>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: [patch] A \pivot command for psql
Date: 2015-08-11 15:13:03
Message-ID: a86225c1-fe22-444b-8402-d5fd806d557c@mm
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

David Fetter wrote:

> That depends on what you mean by "dynamic columns." The approach
> taken in the tablefunc extension is to use functions which return
> SETOF RECORD, which in turn need to be cast at runtime.

For me, "PIVOT with dynamic columns" would be a pivot query
whose output columns are not enumerated as input in the
SQL query itself, in any form.

> The second, more on point, is to specify a serialization for the rows
> in the "dynamic columns" case. Their syntax is "PIVOT XML", but I
> would rather do something more like "PIVOT (SERIALIZATION XML)".

The SERIALIZATION looks interesting, but I believe these days JSON
would make more sense than XML, both as easier for the client-side and
because of all the json_* functions we now have to mix json with
relational structures.

Best regards,
--
Daniel Vérité
PostgreSQL-powered mailer: http://www.manitou-mail.org
Twitter: @DanielVerite

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Fabien COELHO 2015-08-11 15:15:22 Re: checkpointer continuous flushing
Previous Message David Fetter 2015-08-11 14:41:43 Re: [patch] A \pivot command for psql