Re: Strange result using transactions - Mailing list pgsql-general

From Matthijs Melissen
Subject Re: Strange result using transactions
Date
Msg-id 030301c7705c$895ec4e0$5ee26191@Matthijs
Whole thread Raw
In response to Strange result using transactions  ("Matthijs Melissen" <melissen@phil.uu.nl>)
Responses Re: Strange result using transactions
List pgsql-general
Alban Hertroys wrote:
> Pavan Deolasee wrote:
>> On 3/27/07, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>>>
>>> "Matthijs Melissen" <melissen@phil.uu.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'.

> 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.

That is exactly the problem. Sorry for not being clear about that.
I get DELETE 0 even if a record with id=20 already exists before both
transactions.


pgsql-general by date:

Previous
From: Alban Hertroys
Date:
Subject: Re: Strange result using transactions
Next
From: Denis Gasparin
Date:
Subject: Query that does not use indexes