Concurrent insert question - Mailing list pgsql-general

From u15074
Subject Concurrent insert question
Date
Msg-id 1048495086.3e7ec3ee95a05@webmail.hs-harz.de
Whole thread Raw
Responses Re: Concurrent insert question  (Amin Abdulghani <amin@quantiva.com>)
List pgsql-general
I have the following table:

create table test(
key int8,
length int4,
level int4,
pu oid,
primary key(key));

Now I have two concurrent transactions:

At the time the transactions start, there does't exist a row with value 1 for
the key column.

time transactionA:
1    begin;
2    set transaction level serializable;
3    insert into test(1,..,..,..);
4
5    commit;

time transactionB:
1    begin;
2    set transaction level serializable;
3
4    insert into test(1,..,..,..);
5
6    commit;

So my question is, what happens with the insert of transactionB?
Since a row with primary key value 1 doesn't exist within transactionB when
executing the insert-statement, it shouldn't be a problem within the
transaction.
But if so, how will the constraint be fullfilled? Will transactionB be aborted?
Is there a difference running in transaction level serializable or readcommited?

-------------------------------------------------
This mail sent through IMP: http://horde.org/imp/


pgsql-general by date:

Previous
From: "shreedhar"
Date:
Subject: Re: Avoiding duplications in tables
Next
From: "frank_lupo"
Date:
Subject: alter table change type column