[SQL] Static variable inside PL/pgSQL (or) native C function

Поиск
Список
Период
Сортировка
От athinivas
Тема [SQL] Static variable inside PL/pgSQL (or) native C function
Дата
Msg-id 1506692779631-0.post@n3.nabble.com
обсуждение исходный текст
Ответы Re: [SQL] Static variable inside PL/pgSQL (or) native C function  ("David G. Johnston" <david.g.johnston@gmail.com>)
Re: [SQL] Static variable inside PL/pgSQL (or) native C function  (Pavel Stehule <pavel.stehule@gmail.com>)
Список pgsql-sql
Hi,

Is it possible to have static variable inside pgSQL C functions (or)
PL/pgSQL?? I'm having a use case where I need to update a counter inside the
function & it should be thread-safe.

I've tried using static variable inside the C function along with
pthread_mutex_lock/pthread_mutex_unlock. And found functions are not shared
among each other. 

Thanks,
Athi



--
Sent from: http://www.postgresql-archive.org/PostgreSQL-sql-f2142323.html


-- 
Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql

В списке pgsql-sql по дате отправления:

Предыдущее
От: Feike Steenbergen
Дата:
Сообщение: Re: [SQL] Single SQL to find if any record exists across several tables
Следующее
От: Pavel Stehule
Дата:
Сообщение: Re: [SQL] Static variable inside PL/pgSQL (or) native C function