From: | Marco Colombo <pgsql(at)esiway(dot)net> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | Martijn van Oosterhout <kleptog(at)svana(dot)org>, Michael Fuhr <mike(at)fuhr(dot)org>, pgsql-general(at)postgresql(dot)org |
Subject: | Re: plpython function problem workaround |
Date: | 2005-03-18 10:11:21 |
Message-ID: | Pine.LNX.4.61.0503171724210.20758@Megathlon.ESI |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Thu, 17 Mar 2005, Tom Lane wrote:
> Martijn van Oosterhout <kleptog(at)svana(dot)org> writes:
>> On Thu, Mar 17, 2005 at 01:03:36PM +0100, Marco Colombo wrote:
>>> OMG! It's indenting the funtion body. I think you can't do that
>>> w/o being syntax-aware. I'm not familiar with the code, why is it
>>> adding a 'def' in front of it at all? I undestand that once you do
>>> it you'll have to shift the code by an indentation level.
>
>> Presumbly because it wants to create a function, which can later be
>> called. Since python is sensetive to whitespace it has to indent the
>> code to make it work.
>
> Seems like we have to upgrade that thing to have a complete
> understanding of Python lexical rules --- at least enough to know where
> the line boundaries are. Which is pretty much exactly the same as
> knowing which CRs to strip out. So I guess we have a candidate place
> for a solution.
>
> Anyone want to code it up? I don't know enough Python to do it ...
I'm no expert but I'll look into it. Unless someone else already
tried it, I want to investigate first if it's possible to create
a callable object w/o using 'def', which alters the name space and
(the thing we're interested to) needs an extra identation level.
At first sight, what we do now (at function creation time) is:
1) execute a function definition;
2) compile a function call, and save the resulting code object for later use.
I'm wondering if we can save one step, and use a python callable object.
.TM.
--
____/ ____/ /
/ / / Marco Colombo
___/ ___ / / Technical Manager
/ / / ESI s.r.l.
_____/ _____/ _/ Colombo(at)ESI(dot)it
From | Date | Subject | |
---|---|---|---|
Next Message | Alex Stapleton | 2005-03-18 10:23:14 | Re: Select Last n Rows Matching an Index Condition (and caches) |
Previous Message | Martijn van Oosterhout | 2005-03-18 10:03:25 | Re: Select Last n Rows Matching an Index Condition (and caches) |