pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Peter Eisentraut <peter_e@gmx.net>
To: Wei Weng <wweng@kencast.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: Is function atomic?
Date: Fri, 6 Jul 2001 18:49:49 +0200 (CEST)
Message-ID: <Pine.LNX.4.30.0107061844440.679-100000@peter.localdomain> (raw)
In-Reply-To: <994440962.16301.1.camel@Monet>

Wei Weng writes:

> Does that mean if I used
> DECLARE
> ...
> BEGIN
> DO_STUFF
> END;
>
> the DO_STUFF will not be interrupted (maintain atomicity) even when
> multiple threads use the function concurrently?

Interruption, atomicity, and concurrency are separate issues.  The
function could of course be interrupted if there's an error.  (That error
may be related to concurrency, such as a serialization failure.)  The
database interactions of the function will be atomic in the sense that
rollback will work.  Concurrent execution of a function is permitted, but
there may be issues if you modify global state or there is a serialization
failure.  These are the same issues that you have to deal with in any
programming environment.

-- 
Peter Eisentraut   peter_e@gmx.net   http://funkturm.homeip.net/~peter




view thread (11+ messages)  latest in thread

Message-ID: <Pine.LNX.4.30.0107061844440.679-100000@peter.localdomain>
Permalink:  ../Pine.LNX.4.30.0107061844440.679-100000@peter.localdomain/
Also on:    postgresql.org/message-id/Pine.LNX.4.30.0107061844440.679-100000@peter.localdomain

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-sql@postgresql.org
  Cc: peter_e@gmx.net, wweng@kencast.com
  Subject: Re: Is function atomic?
  In-Reply-To: <Pine.LNX.4.30.0107061844440.679-100000@peter.localdomain>
  References: <994440962.16301.1.camel@Monet> <Pine.LNX.4.30.0107061844440.679-100000@peter.localdomain>

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

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