Re: pivot functions with variable number of columns - Mailing list pgsql-general

From Chris Travers
Subject Re: pivot functions with variable number of columns
Date
Msg-id CAKt_Zft5CsGQvr05p-LkEOTAraJYO5fuvT=Q=G87TTrKou2YZA@mail.gmail.com
Whole thread Raw
In response to pivot functions with variable number of columns  (punnoose <punnoose.pj@dwisesolutions.com>)
Responses Re: pivot functions with variable number of columns
List pgsql-general


On Wed, Sep 5, 2012 at 10:14 PM, punnoose <punnoose.pj@dwisesolutions.com> wrote:
I want to have a pivot like function in which i should have variable number
of columns.i went for crosstab but it doesnot support variable number of
columns.Can any body suggest an alternative.like if i have a event at a
particular time of the day like one at 02:35,11:34, then i should have
column name 02:35,11:34.

You could detect the columns you want to return and use a plpgsql function that returns a refcursor, I suppose.

Best Wishes,
Chris travers 

pgsql-general by date:

Previous
From: Raghavendra
Date:
Subject: Re: pivot functions with variable number of columns
Next
From: "Albe Laurenz"
Date:
Subject: Re: Moving several databases into one database with several schemas