On Sat, 20 Oct 2001, Rod Taylor wrote:
> But what if you want a C function to set a variable which can be
> accessed using an SQL, perl, PLpgSQL or other function type?
> Shouldn't a global variable be global between all types of functions?
No. Doing that requires that all languages have the same internal storage
of variables. And it's more than just an int4 takes up 4 bytes. Look in
the plpgsql source, at struct PLpgSQL_var. There is a fair amount of into
about a variable.
While we could harmonize the info storage, making globals global across
all languages would also would mean breaking down a lot of the isolation
between PLs. Right now they are their own independent entities. To tie
them together like this would, in my opinion, make them
fragilly-interconnected.
My suggestion is to just add a get and a set routine in one language, and
have it store the global. :-)
Take care,
Bill