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

Поиск
Список
Период
Сортировка
Искать
От
David G. Johnston
Тема
Re: [SQL] Static variable inside PL/pgSQL (or) native C function
Дата
Msg-id
CAKFQuwbg1efML7CeSTrg8WZ_qOQfmVCYbVWdUXvmbWAsjnmADw@mail.gmail.com
Ответ на
Список
Дерево обсуждения
[SQL] Static variable inside PL/pgSQL (or) native C function athinivas <athinivas@gmail.com>
Re: [SQL] Static variable inside PL/pgSQL (or) native C function Pavel Stehule <pavel.stehule@gmail.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 athinivas <athinivas@gmail.com>
Re: [SQL] Static variable inside PL/pgSQL (or) native C function Pavel Stehule <pavel.stehule@gmail.com>
On Fri, Sep 29, 2017 at 6:46 AM, athinivas <athinivas@gmail.com> wrote:
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.


Don't know what's possible in C; pretty sure no in pl/pgsql.

Why not just use a table and SQL locking features?

Dave​

В списке pgsql-sql по дате отправления
От: Pavel Stehule
Дата:
От: athinivas
Дата:
FAQ