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.