Received: from smtp.snet.net (smtp.snet.net [204.60.6.55]) by postgresql.org (8.11.3/8.11.1) with ESMTP id f66HCua75207 for ; Fri, 6 Jul 2001 13:12:56 -0400 (EDT) (envelope-from wweng@kencast.com) Received: from pop.snet.net (pop.snet.net [204.60.6.9]) by smtp.snet.net (8.11.1/8.11.1/SNET-mx-1.4/D-1.10/O-1.7) with ESMTP id f66HBnC14636; Fri, 6 Jul 2001 13:11:49 -0400 (EDT) Received: from [192.168.1.83] (167.95.252.64.snet.net [64.252.95.167]) by pop.snet.net (8.11.1/8.11.1/SNET-pop-1.5/D-1.8/O-1.6) with ESMTP id f66HBnr18741; Fri, 6 Jul 2001 13:11:49 -0400 (EDT) Subject: Re: Is function atomic? From: Wei Weng To: Peter Eisentraut Cc: pgsql-sql@postgresql.org In-Reply-To: References: Content-Type: text/plain X-Mailer: Evolution/0.10 (Preview Release) Date: 06 Jul 2001 14:17:39 -0400 Message-Id: <994443470.16301.2.camel@Monet> Mime-Version: 1.0 X-Archive-Number: 200107/71 X-Sequence-Number: 3855 What I wanted is simple: I don't want other processes that run the function at the same time have read/write access from the tables this function accesses(select and insert/update). Is it possible, say, let other proccess blocked on this function? On 06 Jul 2001 18:49:49 +0200, Peter Eisentraut wrote: > 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 > > > ---------------------------(end of broadcast)--------------------------- > TIP 6: Have you searched our list archives? > > http://www.postgresql.org/search.mpl > -- Wei Weng Network Software Engineer KenCast Inc.