Re: [GENERAL] dynamic crosstab

2008-02-20 Thread Balázs Klein
I always hope that somebody might have something similar but > generic - eg. create those columns automatically and just treat them all > as text. I came up with this amateurish one based on http://www.ledscripts.com/tech/article/view/5.html. Maybe someone can use it: takes - a select statement

Re: [GENERAL] dynamic crosstab

2008-02-15 Thread Balázs Klein
> -Original Message- > > Do youthink there is a way to ensure that the order of the values in the > > array below is the same for each person? > > > > tbl(eID, aID, value) > > > > Select eID, array_accum(value) from > > ( > > (Select Distinct eID from tbl) e > > CROSS JOIN > > (Select

Re: [GENERAL] dynamic crosstab

2008-02-15 Thread Balázs Klein
> Balázs Klein wrote: > > > > I was hoping that now with PG supporting plan invalidation it would > > be possible to return a recordset. > > Plan invalidation has nothing to do with it. In Postgres a returned > recordset can be used as a row source in the FROM claus

Re: [GENERAL] dynamic crosstab

2008-02-15 Thread Balázs Klein
> given that answers for a questionnaire are stored as a > batch Not in our setup - for all sorts of reasons (preserving responses on a connection failure or restart, monitoring response latency in real time, creating adaptive/branching questionnaires) we send each response separately. > peopl

Re: [GENERAL] dynamic crosstab

2008-02-15 Thread Balázs Klein
Erik Jones wrote: > First, please stop top-posting. It makes it difficult for both me > and others to know to whom/what you are replying. Sorry, I don't know much about mailing list customs - I had to look up what top-posting is. I will behave now ... I would prefer to keep the complications f

Re: [GENERAL] dynamic crosstab

2008-02-15 Thread Balázs Klein
Joe wrote > 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? I think there shou

Re: [GENERAL] dynamic crosstab

2008-02-14 Thread Balázs Klein
2 3 eee this output, without manually enumerating the attributeids: 1 (aaa,bbb,ccc) 2 (ddd,NULL,eee) Thx. B. -Original Message- From: Erik Jones [mailto:[EMAIL PROTECTED] Sent: Thursday, February 14, 2008 5:15 PM To: Balázs Klein Cc: 'Tino Wildenhain'; '

Re: [GENERAL] dynamic crosstab

2008-02-14 Thread Balázs Klein
Yes, once I have the select outputting it to CSV is not a problem. As you say PG handles that nicely. Thx SWK -Original Message- From: Reece Hart [mailto:[EMAIL PROTECTED] Sent: Wednesday, February 13, 2008 9:39 PM To: Tino Wildenhain Cc: SunWuKung; pgsql-general@postgresql.org Subject:

Re: [GENERAL] dynamic crosstab

2008-02-14 Thread Balázs Klein
Hi, ye, hundreds of columns - but there is no helping it, that’s the way many questionnaire are and the representation of the responses (when not in a database) is always one person per row. I would need this for exporting, but also to show results online. Although it’s a good idea I am afraid

Re: [GENERAL] dynamic crosstab

2008-02-14 Thread Balázs Klein
Hi, Yes I know that SPSS can do this - in fact that is the only way I could solve this so far, but that is a very expensive workaround for anybody not currently owning SPSS. Thanks. SWK -Original Message- From: jr [mailto:[EMAIL PROTECTED] Sent: Wednesday, February 13, 2008 1:31 PM