Re: Is this doable using Postgresql crosstab or some other function? - Mailing list pgsql-general

From Merlin Moncure
Subject Re: Is this doable using Postgresql crosstab or some other function?
Date
Msg-id CAHyXU0x__sxwseSmrndk+ZgMN6=-3hm8bD3MqLyYkSF3iAjtEg@mail.gmail.com
Whole thread Raw
In response to Re: Is this doable using Postgresql crosstab or some other function?  (Mika M Lehtonen <mika@digikartta.net>)
Responses Re: Is this doable using Postgresql crosstab or some other function?  (Andrew Sullivan <ajs@crankycanuck.ca>)
List pgsql-general
On Tue, Apr 10, 2012 at 9:31 AM, Mika M Lehtonen <mika@digikartta.net> wrote:
> Merlin,
> thanks for your reply. Semidoable? Let's break this into parts:
> 1) Is it possible to create a view which have dynamic number of colums based
> on the select response?

Mostly no.  A hardwired restriction is that a view has a rigidly
defined list of columns with defined types.  You can skirt that
restriction a couple of ways -- for example your view could be a
single column text (or xml, or hstore) with the columns you want
encoded into it.

> 2) Is it possible to name view colums based on some data retrieved with
> select statement?

nope -- in fact the point of views is to create a well defined
representation of something which is the opposite of what you are
trying to do.

> My pseudo definition, which was already simplified, could be simlified more.
> Maybe I do that and try crosstab for starters. As I told John, this model is
> one that works fine in one large application using MS SQL-Server. This view
> I am trying to create, is something that the application mentioned doesn't
> include. The model itself has been proven to be all working and extremely
> dynamical.
>
> This is what I discussed with John outside the list, forgive me, I didn't
> notice that, neither did John I guess..

merlin

pgsql-general by date:

Previous
From: Mika M Lehtonen
Date:
Subject: Re: Is this doable using Postgresql crosstab or some other function?
Next
From: Andrew Sullivan
Date:
Subject: Re: Is this doable using Postgresql crosstab or some other function?