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

From Daniel Verite
Subject Re: [patch] A \pivot command for psql
Date
Msg-id a86225c1-fe22-444b-8402-d5fd806d557c@mm
Whole thread Raw
In response to Re: [patch] A \pivot command for psql  (David Fetter <david@fetter.org>)
Responses Re: [patch] A \pivot command for psql  (David Fetter <david@fetter.org>)
List 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



pgsql-hackers by date:

Previous
From: David Fetter
Date:
Subject: Re: [patch] A \pivot command for psql
Next
From: Fabien COELHO
Date:
Subject: Re: checkpointer continuous flushing