Re: PlPython

From: elein <elein(at)varlena(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Kevin Jacobs <jacobs(at)penguin(dot)theopalgroup(dot)com>, joconnor(at)cybermesa(dot)com, pgsql-general(at)postgresql(dot)org
Subject: Re: PlPython
Date: 2003-06-30 21:59:30
Message-ID: 200306301459.30195.elein@varlena.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers


7.3 doc says:

>The global dictionary SD is available to store data between function calls. This variable is private static data.
>The global dictionary GD is public data, available to all Python functions within a session. Use with care.>

>Each function gets its own restricted execution object in the Python interpreter, so that global data and >
>function arguments from myfunc are not available to myfunc2.
>The exception is the data in the GD dictionary, as mentioned above.

I think the above is correct, and the terms I used could be confusing. The doc
is calling both GD and SD global data. These are distinct from the function arguments.
Function arguments are distinct to the invocation of the function.
You can get to GD elements from any called plpython function. You can get to SD elements
only from (re-)calling the same plpython function.

How about changing the second paragraph to:

Each function gets its own restricted execution object in the Python interpreter so that SD global
data and function arguments from myfunc are not available to myfunc2. Data stored in the
GD dictionary by myfunc may be accessed by myfunc2.

More than you wanted to know, I'm sure.

elein

On Monday 30 June 2003 14:49, Tom Lane wrote:
> elein <elein(at)varlena(dot)com> writes:
> > The global data (GD) and function data (SD)
> > work as they always have worked.
>
> Right, but the para at issue was claiming you couldn't access any global
> data *except* GD.
>
> regards, tom lane
>
>

--
=============================================================
elein(at)varlena(dot)com Database Consulting www.varlena.com
PostgreSQL General Bits http:/www.varlena.com/GeneralBits/
"Free your mind the rest will follow" -- en vogue

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Patrick Hatcher 2003-06-30 22:03:52 Pg_Dumpall error?
Previous Message Tom Lane 2003-06-30 21:49:40 Re: PlPython

Browse pgsql-hackers by date

  From Date Subject
Next Message Maksim Likharev 2003-06-30 22:57:26 Share state ( allocated memory ) across two C functions...
Previous Message Tom Lane 2003-06-30 21:49:40 Re: PlPython