From: | Alban Hertroys <alban(at)magproductions(dot)nl> |
---|---|
To: | Pavan Deolasee <pavan(dot)deolasee(at)gmail(dot)com> |
Cc: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Matthijs Melissen <melissen(at)phil(dot)uu(dot)nl>, pgsql-general(at)postgresql(dot)org |
Subject: | Re: Strange result using transactions |
Date: | 2007-03-27 10:16:52 |
Message-ID: | 4608EF14.8000706@magproductions.nl |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Pavan Deolasee wrote:
> On 3/27/07, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>>
>> "Matthijs Melissen" <melissen(at)phil(dot)uu(dot)nl> writes:
>> > I am executing the following queries (id has a unique key):
>> > 1) begin;
>> > 1) delete from forum where id = 20;
>> > 1) insert into forum (id, name) values (20, 'test');
>> > 2) delete from forum where id = 20;
>> > 1) commit;
>>
>> > The problem is that process 2 gets the message 'DELETE 0'. I would
>> expect
>> > him to get the message 'DELETE 1'.
>>
>> Why do you find that strange? Process 1 hasn't committed its insert yet.
>>
>>
> I think what he is saying that *after* txn 1 commits, txn 2 does not see
> the
> record inserted by txn1. Isn't that a fair point ? I mean txn 2 can see the
> DELETE operation of txn 1, but can not see the INSERT operation of the
> same transaction.
Not necessarily so. I'd expect only to see a successful delete in txn 2
if a record with id = 20 existed prior to the beginning of txn 1. If
that wasn't the case, then there's nothing to delete in txn 2.
--
Alban Hertroys
alban(at)magproductions(dot)nl
magproductions b.v.
T: ++31(0)534346874
F: ++31(0)534346876
M:
I: www.magproductions.nl
A: Postbus 416
7500 AK Enschede
// Integrate Your World //
From | Date | Subject | |
---|---|---|---|
Next Message | Matthijs Melissen | 2007-03-27 10:41:53 | Re: Strange result using transactions |
Previous Message | Dmitry Koterov | 2007-03-27 10:10:17 | Re: Temporarily disable all table indices |