Skip site navigation (1) Skip section navigation (2)

Re: Question about isolation

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Samuel Tardieu <sam(at)rfc1149(dot)net>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: Question about isolation
Date: 2004-01-28 23:03:25
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-sql
Samuel Tardieu <sam(at)rfc1149(dot)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

In response to

pgsql-sql by date

Next:From: Octavio AlvarezDate: 2004-01-29 04:27:00
Subject: LEFT JOIN on one and/or another column
Previous:From: Samuel TardieuDate: 2004-01-28 21:45:13
Subject: Re: Question about isolation

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group