Re: dynamic crosstab - Mailing list pgsql-general

From Webb Sprague
Subject Re: dynamic crosstab
Date
Msg-id b11ea23c0802191040o2595cdd7j4c183f1ded615a4d@mail.gmail.com
Whole thread Raw
In response to Re: dynamic crosstab  (David Fetter <david@fetter.org>)
List pgsql-general
> > > It occurs to me that it shouldn't be terribly difficult to make an
> > > alternate version of crosstab() that returns an array rather than
> > > tuples  (back when crosstab() was first written, Postgres didn't
> > > support NULL  array elements). Is this worth considering for 8.4?
> >
> > How about returning generic rows?  Is that possible?
>
> One hack I've used in the past to get those is serializing the rows:
> XML, YAML and most recently JSON.
>
> > It would be really neat if you didn't have to specify the return
> > type in the query that invoked the crosstab.
>
> It would be handy :)

+1

What about (for a 2 dim crosstab anyway) take a table and two column
names to group by, and return the following results:  an  1-d array
with the column names, a 1-d with the rownames, and a 2-d array with
the cell values; a function to take these three arrays and make csv
readable text would be great; also  a function to "explode" the arrays
into a table (like an array_accum inverse), but this would take a type
or something.

Is this what every one means  anyway?

pgsql-general by date:

Previous
From: David Fetter
Date:
Subject: Re: dynamic crosstab
Next
From: "Dave Page"
Date:
Subject: Re: MS library files