X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 5B354D1B95A for ; Wed, 28 Jan 2004 23:03:55 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 44268-09 for ; Wed, 28 Jan 2004 19:03:26 -0400 (AST) Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by svr1.postgresql.org (Postfix) with ESMTP id 53D03D1B4E0 for ; Wed, 28 Jan 2004 19:03:23 -0400 (AST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.11/8.12.11) with ESMTP id i0SN3Pha007528; Wed, 28 Jan 2004 18:03:25 -0500 (EST) To: Samuel Tardieu Cc: pgsql-sql@postgresql.org Subject: Re: Question about isolation In-reply-to: <871xpj928m.fsf@beeblebrox.enst.fr> References: <871xpj928m.fsf@beeblebrox.enst.fr> Comments: In-reply-to Samuel Tardieu message dated "Wed, 28 Jan 2004 22:45:13 +0100" Date: Wed, 28 Jan 2004 18:03:25 -0500 Message-ID: <7527.1075331005@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200401/243 X-Sequence-Number: 16636 Samuel Tardieu writes: >>> Do I have the guarantee that, in any event, rows deleted from >>> table t by the delete won't reappear in the select result? >> >> i do not think you have that guarantee in READ COMMITTED mode >> because there is a slight possibility another backend sneaked a >> committed insert in between the delete and select >> statement. > Yes. But the possible effect your describe (insertion of new rows > after the DELETE statement and before the SELECT) matches accurately > the symptoms we are observing. Hmm. I think you need to look closer. AFAIR the READ COMMITTED behavior is only an issue if you give the commands interactively from the client. Inside a plpgsql function we do not do SetQuerySnapshot() and therefore the snapshot of other transactions' effects does not advance. So I think the coding should be safe ... at the moment. (A number of people think the lack of SetQuerySnapshot inside functions is a bug; so the behavior might change in future.) Using SERIALIZABLE mode would probably make your code more future-proof, but if you are presently seeing failures, there's some other effect involved here. regards, tom lane