Re: crosstab

Поиск
Список
Период
Сортировка
От Merlin Moncure
Тема Re: crosstab
Дата
Msg-id CAHyXU0y1R1LuDO2fjFnihCDaP71eY9DrQYzz+ysSwThrVLfkqw@mail.gmail.com
обсуждение исходный текст
Ответ на crosstab  (punnoose <punnoose.pj@dwisesolutions.com>)
Список pgsql-general
On Tue, Sep 4, 2012 at 10:39 AM, punnoose
<punnoose.pj@dwisesolutions.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


В списке pgsql-general по дате отправления:

Предыдущее
От: Misa Simic
Дата:
Сообщение: Re: crosstab
Следующее
От: Joe Conway
Дата:
Сообщение: Re: crosstab