Ivan Sergio Borgonovo <mail(at)webthatworks(dot)it> writes:
> I've some strong suspect... and I'd like to exit earlier from a
> function if a process is running but I'm not really sure how to add a
> semaphore...
Maybe pg_try_advisory_lock() would help you there?
http://www.postgresql.org/docs/8.3/static/explicit-locking.html#ADVISORY-LOCKS
http://www.postgresql.org/docs/8.3/static/functions-admin.html#FUNCTIONS-ADVISORY-LOCKS
Regards,
--
Dimitri Fontaine
http://2ndQuadrant.fr PostgreSQL : Expertise, Formation et Support