Re: dynamic crosstab

From: "Webb Sprague" <webb(dot)sprague(at)gmail(dot)com>
To:
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: dynamic crosstab
Date: 2008-02-19 18:40:56
Message-ID: b11ea23c0802191040o2595cdd7j4c183f1ded615a4d@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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?

In response to

Browse pgsql-general by date

  From Date Subject
Next Message brrCv 2008-02-19 18:44:18 Re: initdb problem with Windows Installer for PostgreSQL 8.2.4
Previous Message David Fetter 2008-02-19 18:19:59 Re: dynamic crosstab