Re: UNIQUE INDEX unaware of transactions - Mailing list pgsql-hackers

From Doug McNaught
Subject Re: UNIQUE INDEX unaware of transactions
Date
Msg-id m366dxlpja.fsf@belphigor.mcnaught.org
Whole thread Raw
In response to UNIQUE INDEX unaware of transactions  (Hannu Krosing <hannu@tm.ee>)
Responses UNIQUE INDEX unaware of transactions (a spin of question)
List pgsql-hackers
Hannu Krosing <hannu@tm.ee> writes:

> It seems that our current way of enforcing uniqueness knows nothing 
> about transactions ;(
> 
> when you 
> 
> create table t(
>   i int4 primary key
> );"""
> 
> and then run the following query 
> 
> begin;
>   delete from t where i=1;
>   insert into t(i) values(1);
> end;
> 
> in a loop from two parallel processes in a loop then one of them will 
> almost instantaneously err out with  
> 
> ERROR:  Cannot insert a duplicate key into unique index t_pkey

Have you tried running this test with transaction isolation set to
SERIALIZABLE? 

-Doug
-- 
The rain man gave me two cures; he said jump right in,
The first was Texas medicine--the second was just railroad gin,
And like a fool I mixed them, and it strangled up my mind,
Now people just get uglier, and I got no sense of time...          --Dylan


pgsql-hackers by date:

Previous
From: Vince Vielhaber
Date:
Subject: Re: Encrypting pg_shadow passwords
Next
From: Peter Eisentraut
Date:
Subject: Re: Encrypting pg_shadow passwords