Re: Strange result using transactions

From: "Matthijs Melissen" <melissen(at)phil(dot)uu(dot)nl>
To: <pgsql-general(at)postgresql(dot)org>
Subject: Re: Strange result using transactions
Date: 2007-03-27 10:41:53
Message-ID: 030301c7705c$895ec4e0$5ee26191@Matthijs
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Alban Hertroys wrote:
> 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'.

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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Denis Gasparin 2007-03-27 10:54:49 Query that does not use indexes
Previous Message Alban Hertroys 2007-03-27 10:16:52 Re: Strange result using transactions