[SQL] Static variable inside PL/pgSQL (or) native C function - Mailing list pgsql-sql

From athinivas
Subject [SQL] Static variable inside PL/pgSQL (or) native C function
Date
Msg-id 1506692779631-0.post@n3.nabble.com
Whole thread Raw
Responses Re: [SQL] Static variable inside PL/pgSQL (or) native C function
Re: [SQL] Static variable inside PL/pgSQL (or) native C function
List 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 by date:

Previous
From: Feike Steenbergen
Date:
Subject: Re: [SQL] Single SQL to find if any record exists across several tables
Next
From: Pavel Stehule
Date:
Subject: Re: [SQL] Static variable inside PL/pgSQL (or) native C function