Re: Question(s) about crosstab

From: John Abraham <jea(at)hbaspecto(dot)com>
To: Joe Conway <mail(at)joeconway(dot)com>
Cc: pgsql-general(at)postgresql(dot)org, ken(dot)tanzer(at)gmail(dot)com, polobo(at)yahoo(dot)com, scott(dot)marlowe(at)gmail(dot)com
Subject: Re: Question(s) about crosstab
Date: 2013-12-18 23:14:23
Message-ID: 26DF39E7-BF57-4A73-AA65-A41A74CB1359@hbaspecto.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


On Dec 18, 2013, at 3:52 PM, Joe Conway <mail(at)joeconway(dot)com> wrote:
>
>> 3) Can't "someone" write a pl language routine that does it better? I'd be willing to work on the core
>> functionality in python if someone else would be willing to embed it in plpython (I've never used plpython.)
>
> 3) Not possible -- reason was given down thread. Column definition must be known/determinable by the parser prior to query execution.

No, wait, I think you misunderstood my idea. Can’t we have a python function that crosstabs the data in python, then creates a new table, then inserts that data into the new table by looping through a bunch of inserts?

The parser wouldn’t’ need to know a thing. There would be no output from the function itself, it would just create a table while it ran. (I suppose it could return the name of the table, or a boolean success/fail flag, or return the number of columns that were created, but all of these are simple things knowable to the parser in advance.)

I’ve written functions before in plpgsql that create tables behind the scenes, and basically return no output themselves.


John

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message AI Rumman 2013-12-18 23:20:26 Re: Question(s) about crosstab
Previous Message Scott Marlowe 2013-12-18 23:12:52 Re: Multi Master Replication