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 -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers