agora inbox for pgsql-sql@postgresql.org  
help / color / mirror / Atom feed
From: athinivas <athinivas@gmail.com>
To: pgsql-sql@postgresql.org
Subject: Static variable inside PL/pgSQL (or) native C function
Date: Fri, 29 Sep 2017 06:46:19 -0700 (MST)
Message-ID: <1506692779631-0.post@n3.nabble.com> (raw)
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-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



view thread (5+ messages)  latest in thread

Message-ID: <1506692779631-0.post@n3.nabble.com>
Permalink:  ../1506692779631-0.post@n3.nabble.com/
Also on:    postgresql.org/message-id/1506692779631-0.post@n3.nabble.com

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: athinivas@gmail.com
  Subject: Re: Static variable inside PL/pgSQL (or) native C function
  In-Reply-To: <1506692779631-0.post@n3.nabble.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox