Re: dynamic crosstab

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Pierre Chevalier <pierre(dot)chevalier1967(at)free(dot)fr>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: dynamic crosstab
Date: 2010-01-27 07:13:28
Message-ID: 162867791001262313r11d535f0t216c8d64ae32c259@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

2010/1/27 Pierre Chevalier <pierre(dot)chevalier1967(at)free(dot)fr>:
> Hello,
>
> Some time ago, it was written here:
>>
>> ...
>> I think there should be a generic way in Postgres to return from an EAV
>> model. Although I have no evidence on that I keep thinking that the db must
>> be more effective at that than the application would be.
>> ...
>>
>> Yes, thanks.
>> The problem with those function is that they all have an AS (columname
>> type,...) part or equivalent.
>
>
> SWK, I fully understand your needs, and your (our) kind of frustration...
>
> I am in a similar situation, with an EAV table, and the need to do crosstab
> queries, without knowing in advance which columns the query should return,
> and how many columns.
> This is for chemical analysis results; laboratories store their results in
> an EAV way, and it is definitely a good choice, for a large number of
> reasons.
>
> On your side, have you found a decent solution?
> Has anyone got an answer?
>
> I am just about to try this one:
> http://www.ledscripts.com/tech/article/view/5.html
> <http://www.ledscripts.com/tech/article/view/5.ht=>
>
> But I don't like this style too much: the crosstab approach seems more
> "natural" to me. I may be totally wrong.
>
> So if there is a crosstab thing working in a generic way, that would be just
> super!

you cannot get crosstab via SELECT statement. There is workaround

http://okbob.blogspot.com/2008/08/using-cursors-for-generating-cross.html

Pavel

>
> A+
> Pierre
>
>
>
> --
> Sent via pgsql-general mailing list (pgsql-general(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-general
>

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Pierre Chevalier 2010-01-27 08:52:24 Re: dynamic crosstab
Previous Message hx.li 2010-01-27 06:36:43 [GRNERAL] drop domain xx cascade