Re: duplicates - Mailing list pgsql-admin

From Michael Paesold
Subject Re: duplicates
Date
Msg-id 00be01c493ff$82814530$ad01a8c0@zaphod
Whole thread Raw
In response to duplicates  (Tsirkin Evgeny <tsurkin@mail.jct.ac.il>)
Responses Re: duplicates
List pgsql-admin
I wrote:

> BEGIN;
> SET TRANSACTION ISOLATION LEVEL SERIALIZABLE;
>
> DELETE FROM schedule WHERE studentid = ... ;
> INSERT INTO schedule (studentid, ...) VALUES (... );
> INSERT INTO schedule (studentid, ...) VALUES (... );
>
> COMMIT;
>
> If you do it like in the above sql code, there is still a problem. The
> serializable checking here only works, if DELETE FROM schedule... really
> finds at least one row. If it does not, it will not recognize the
> serialization problem. So it's still possible that your programm creates
> duplicates.
>
> I have tested this here. I don't really know if this is just the case with
> PostgreSQL serializable transactions (MVCC limitation) or a general
problem.

There is a detailed description about this problem in Section 12.2.2.1. of
the PostgreSQL 8 docs here:
http://developer.postgresql.org/docs/postgres/transaction-iso.html

(Serializable Isolation versus True Serializability)

Best Regards,
Michael Paesold


pgsql-admin by date:

Previous
From: "Michael Paesold"
Date:
Subject: Re: duplicates
Next
From: Tsirkin Evgeny
Date:
Subject: Re: duplicates