From: Tom Lane <tgl@sss.pgh.pa.us>
To: Samuel Tardieu <sam@rfc1149.net>
Cc: pgsql-sql@postgresql.org
Subject: Re: Question about isolation
Date: Wed, 28 Jan 2004 18:03:25 -0500
Message-ID: <7527.1075331005@sss.pgh.pa.us> (raw)
In-Reply-To: <871xpj928m.fsf@beeblebrox.enst.fr>
References: <Pine.BSO.4.44.0401281507300.30592-100000@detroit.arbor.net>
<Pine.BSO.4.44.0401281534400.30592-100000@detroit.arbor.net>
<871xpj928m.fsf@beeblebrox.enst.fr>
Samuel Tardieu <sam@rfc1149.net> 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
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 using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: tgl@sss.pgh.pa.us, sam@rfc1149.net
Subject: Re: Question about isolation
In-Reply-To: <7527.1075331005@sss.pgh.pa.us>
* 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