Re: PlPython - Mailing list pgsql-general

From elein
Subject Re: PlPython
Date
Msg-id 200306301459.30195.elein@varlena.com
Whole thread Raw
In response to Re: PlPython  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-general
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@varlena.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@varlena.com     Database Consulting     www.varlena.com
PostgreSQL General Bits    http:/www.varlena.com/GeneralBits/
   "Free your mind the rest will follow" -- en vogue


pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: PlPython
Next
From: "Patrick Hatcher"
Date:
Subject: Pg_Dumpall error?