Re: Is function atomic?

From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: Wei Weng <wweng(at)kencast(dot)com>
Cc: <pgsql-sql(at)postgresql(dot)org>
Subject: Re: Is function atomic?
Date: 2001-07-06 16:49:49
Message-ID: Pine.LNX.4.30.0107061844440.679-100000@peter.localdomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

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(at)gmx(dot)net http://funkturm.homeip.net/~peter

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Peter Eisentraut 2001-07-06 17:25:38 Re: Is function atomic?
Previous Message Richard Huxton 2001-07-06 16:44:22 Re: Is function atomic?