Обсуждение: static variables in functions

Поиск
Список
Период
Сортировка

static variables in functions

От
"Gyozo Papp"
Дата:
hello everyone,

is there any possibility to keep the value of an arbitrary type variable in a plpgsql function between its invocations?
If not, can it be made with functions written in C instead? I've "static storage" in my mind.
Can it be made thread-safe?

- Papp Gyozo -



Re: static variables in functions

От
Karel Zak
Дата:
On Fri, Apr 20, 2001 at 10:35:36AM +0200, Gyozo Papp wrote:
> hello everyone,
>
> is there any possibility to keep the value of an arbitrary type variable in a plpgsql function between its
invocations?
> If not, can it be made with functions written in C instead? I've "static storage" in my mind.
> Can it be made thread-safe?

 The PG backend isn't multi-thread program. You can use "static", if you
sure what you do :-) If you allocate it you must be sure if you use some
persisten memory context or you can use native malloc(), ..etc.

 Or is possible define arbitrary function as cacheable.

                Karel


--
 Karel Zak  <zakkr@zf.jcu.cz>
 http://home.zf.jcu.cz/~zakkr/

 C, PostgreSQL, PHP, WWW, http://docs.linux.cz, http://mape.jcu.cz