From: | Merlin Moncure <mmoncure(at)gmail(dot)com> |
---|---|
To: | punnoose <punnoose(dot)pj(at)dwisesolutions(dot)com> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: crosstab |
Date: | 2012-09-04 20:56:02 |
Message-ID: | CAHyXU0y1R1LuDO2fjFnihCDaP71eY9DrQYzz+ysSwThrVLfkqw@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Tue, Sep 4, 2012 at 10:39 AM, punnoose
<punnoose(dot)pj(at)dwisesolutions(dot)com> wrote:
> hi all
> How could i use crostab to display variable number of columns. in the output
> There could be variable number of columns
> Regards
> Punnoose
No. The workaround I use is to write a query generator in pl/pgsql
(you can also do it in the client) which queries the specific columns
that are going to be crosstabbed and generates a query textually.
That query is returned to the client and executed, essentially
bypassing the restriction. The way functions are implemented in
postgres forces them to have a rigidly defined set of output
columns...it's annoying and everybody hates it but that's the way
things have to be for various reasons.
Looking to the future, stored procedures might not end up having this
restriction depending on how they are implemented. Now that LATERAL
and standalone backends are or are in the process of being knocked out
I consider stored procedures to be one of the great unsolved features
of postgres.
merlin
From | Date | Subject | |
---|---|---|---|
Next Message | Joe Conway | 2012-09-04 21:06:35 | Re: crosstab |
Previous Message | Misa Simic | 2012-09-04 20:51:00 | Re: crosstab |